|Page (1) of 7 - 07/02/04||email article||print page|
ActionScript for Designers, Part TwoWho's Up For A Little Target Practice?
(Ed. note: Part one of this tutorial is available here).
If you're reading this now, you either 1) bought into the whole "you should really be using ActionScript even though you're a designer" schpiel I outlined in our last installment, or 2) are here as a result of some sort of freak accident. Either way, today we're going to embark on the second leg of our journey into the strange and wonderful world of ActionScript, this time focusing on object targeting by examining how Flash keeps track of stuff behind the scenes.
First thing's first: what in God's green name (as a friend of mine once misspoke) do these target thingees have to do with learning ActionScript? Well, if you've tried to get going with ActionScript before, your initial stumbling out of the gate may have had a lot to do with the the huge potential for confusion in figuring out where things are in your average, everyday Flash movie. I know my first furtive forays into Flash scripting were fraught with frustration (and how's that for alliteration, huh?), so taking the time to figure out how Flash is internally keeping track of everything and how to control the process for the purposes of writing working ActionScript was a huge step for me. In a nutshell, learning Flash's targeting system will help you accomplish the two following things:
- You'll be able to use ActionScript to control (or just observe) the most far-flung reaches of your Flash movie from anywhere else in the movie.
- Eventually, you'll end up organizing your movies better, so you'll become even more efficient when using Flash.
Sounds good, right? It is. So, to quote the last words spoken on the final episode of a show that I already dearly miss, "let's go to work."
Order from chaos
The first thing we have to do is run through Flash's idea of symbols a bit. Why? Because only certain symbol types can become traceable for the purposes of writing ActionScript. I'm assuming that you've all used symbols by now, whether you're aware of it or not. You know those seemingly random "Tween 1" and "Tween 2" symbols that show up in your Library sometimes (fig. 1)? Those symbols aren't so random. Those appear if you've tried to animate a "raw" object without converting it to a symbol first, and those provide the first clue to what Flash is doing behind the scenes.
Figure 1: Auto-generated Tween symbols ? the bane of many an anal-retentive Flash designer's existence.
Flash needs to make objects into symbols in order to be able to animate them, so it's doing the work for you when you see all those auto-generated Tween symbols appear in the Library. Just as Flash needs to "formalize" the objects in your movie to make them ready to animate, by extension, making symbols is the first step you need to take in order to make your Flash objects ActionScript ready. Making symbols yourself (as opposed to Flash doing it for you when you animate) is something you need to be really proactive about, because I'm relatively sure that it's easier to hunt down a particular symbol in a library full of (potentially) thousands of 'em if you've named it yourself and already know what you're looking for. Anyway, when you select an object in the Timeline and press F8, which is the handy-dandy keyboard shortcut to make a selected object a symbol, you get the options shown in Figure 2:
Related Keywords:Flash, Flash MX, Flash MX 2004, ActionScript