02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Split Paths : Timeline Coding

Reviewing the more simple and traditional way of developing in flash: taking the easy path. In this video we break down the timeline and explain how to utilize it with code for Flash.

Split Paths cont. Timeline Coding

For Flash coding, if you choose not to work in OOP the opposing alternative is timeline coding. Learn what this means, how to create a layer, and use frames effectively. Start by simply clicking the first frame on the TimeLine, opening the Actions Panel, and then typing:


trace ("Hello World");


Find out what happens when you run this application!


Now you see the different paths available for programming in Flash: the traditional timeline coding, or OOP. While Timeline coding is simple to begin with, the longer you do it, the harder it gets as you must search for more complicated things to add. If you simply start coding using OOP, possibly the learning curve is steeper but the farther you go, the easier it gets. In the long run, OOP saves time and trouble: this verifies the answer to "why use OOP" !

Timeline Coding Video Transcript

Video Transcript

00:00Now, if you choose not to work in this format, and again, we recommend that you do, but if
00:06you choose not to, the way you would do that is if you click on your main again, back
00:10into your main FLA, and you go into your properties panel, what you would want to do is you'd
00:15want to delete your main reference.
00:18And when you delete your main reference, now there's no linkage between our main and
00:22our class.
00:23So now we click on our edit, this is not going to go anywhere.
00:26It's going to ask us to put a name because we don't really have one.
00:30And I'm going to save my file now.
00:32Now, because I've opened this file previously in an earlier version, then it's asking me
00:36if I want to save it up to Flash CS5.
00:39So I am not going to save it right now because it's not really important for me to save.
00:43Now, if I run the application now, it's going to output nothing, right?
00:48Because there's no connection now between our main and our AS file.
00:52The way we would program if we choose to work not in an object-oriented mode is to
00:56go to our timeline.
00:58We're going to create a new layer, and we're going to name that layer.
01:03So I'm going to double-click on Layer 2, and I'm going to select everything here.
01:06And I'm going to type your AS just to make sure that everyone knows that our code is
01:12in the AS layer.
01:16Now that we have our AS selected, I have to select the first frame, which every one of
01:21these lines are possible frames, although they're disabled frames.
01:26These don't exist, yet only active frames right now, these two.
01:29And I want to select my frame right now in frame 1.
01:33We want to select the frame in frame 1.
01:37And now that it's selected, I could click on my Window Actions panel.
01:42Now make sure that you don't have by mistake something selected.
01:45So if I just go and I create here a rectangle, and it has a really big, thick stroke, but
01:52that's fine, and you can see now that it's selected, you'll see that in Action
01:54Script 3, code cannot be placed directly on objects.
01:59Please select a frame or use the Code Snippets panel, yada, yada, yada.
02:06To our point, what that means is that we want to make sure that our frame is selected
02:10and not the object.
02:11And the way I make sure that that will happen is any items that I create, I don't create
02:15on the same layer as my AS layer.
02:18So I like to just lock my AS layer, making sure that I won't put anything on it.
02:22So I could select that layer and directly go into my Actions panel, and then I could
02:29start coding.
02:30So for example, if previously we saw the sample of Hello World, let's create that sample again.
02:36We could just type Trace, open a round bracket, open a double quote, type Hello World, close
02:51our double quote, close our round bracket, and then semicolon.
02:56And now if we run our application, we should be getting in our output panel, Hello World.
03:05And that's all you really need to do to make that choice between our path of the object-oriented
03:09path and the traditional path of coding directly on the timeline.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!