|Page (1) of 3 - 10/10/05||email article||print page|
ActionScript for Designers, Part 3Nothing like a little detour after a really, really long break
Sixteen months. That's how long it's been since part 2 of this series, which, for the curious, happened to be a whirlwind tour of how to target symbols in Flash. While there was a good reason for this protracted absence (I was insanely busy and not writing anything for a year), it's still been WAY too long between installments. Today, all that gets rectified (I hope), provided you can get over the not-entirely-small fact that I'm going to renege on what I promised we were going to do last time. How's that for a page turner?
A quick recap
In the first installment, I tried to convince you that learning at least some ActionScript is very much worth the time it takes to do. In the second part, as I already mentioned, I went through the ins and outs of how Flash targets symbols you place on the stage. If you'd like to review, feel free to click on the links above and we'll be all caught up.
Now, at the end of part 2, I promised the following:
Next time we're going to start doing some actual work. You'll get acquainted with the Actions panel, I'll show you a GUI you can use for targeting (when things get hairy), and we'll actually create some honest-to-goodness, working code to start us on our way to ActionScript bliss.
As much as it pains me, I have to put that off until the next installment. It's done in the interest of actually presenting a coherent series of pieces here, as I've come to the conclusion that the April 2004 version of me wasn't thinking very clearly. At least, my previous self wasn't yet aware of the existence of Flash 8 (in fairness, nor should I have been, seeing as it would be over a year until Flash 8 was even announced) and its features that definitely make the beginning scripter's life a lot easier. Therefore, a small detour from the original plan is in order to put our collective ducks in a row. Anyway, I've got things more or less figured out now, so let's continue, shall we?
Finding scripts where they live
In order to get ready to do things the easy way (which I really promise we'll start to do next time), I need to answer to a pretty fundamental question: Where do you even put scripts in the first place? Now, I'm writing all this with the assumption that you have at least a little Flash experience, and with that as the case, I'm further assuming that you've used the Timeline to create keyframe-based animation at some point in the past. That's good, because you're then already familiar with the first place scripts can go (the Timeline, of course). These Timeline-based scripts are commonly known as frame scripts, and let's do a quick exercise to illustrate this point:
- Launch Flash. If you need a copy, download the trial version (Flash 8 was just released as of this writing) from Macromedia's site.
- Create a new Flash document (depending on the preferences you've set, you can do so from the Start Panel that opens automatically when Flash launches or by selecting File:New from the menu).
- Select frame 1 of Layer 1 in the Timeline by clicking once on it.
- If it's not open already, open the Actions Panel by selecting Window:Actions from the menu.
- Type stop(); into the Actions panel.
If all went well, you've not only written your first script (congratulations, woo hoo), but your previously blank frame in Layer 1 should look like Figure 1.
See that little teeny tiny "a" icon at the top of the frame? It's there to indicate the presence of a script, one which the Actions panel will automagically reveal when you click on any frame containing the aforementioned little teeny tiny "a" icon. Simple enough, right? Wrong! Again, since you're already familiar with the Timeline, you're no doubt aware that Flash can have tons of layers in the Timeline, each with (potentially) thousands of frames. And when you throw in the fact that Flash's Movie Clip paradigm means that you can have tons of clips thrown into the mix, each one with their own independent Timeline, there are literally buhjillions of places for a script to get lost. So here's helpful hint number one: in any Timeline, whether it's one at the top level of your movie or one embedded in a Movie Clip, make sure the first thing you do is create two layers at the top of your Timeline. Name one actions and the other labels (fig. 2).
Related Keywords:actionscript, flash, flash 8 professional, studio 8
To Comment on This Article, Click HERE
Most Recent Reader Comments:
Click Here To Read All Posts
Must be Registered to Respond (Free Registration!!!, CLICK HERE)