Chapter 9. Automating Flash with ActionScript

When you’ve got your Flash document on your PC, you’re in control. You can make it do whatever you want, whenever you want. But eventually, your creation must strike out on its own. You won’t be there to tell your animation what to do when someone clicks a button or remind it to turn off the sound after the first three times through. You need to provide instructions to make your animation perform automatically—that is, automate it.

To automate your animation or make it interactive, you use ActionScript—Flash’s built-in programming language—to act on, or script, the different parts of your animation. For example, you can instruct your animation to load a Web page when someone clicks a button you’ve added, to start playing an audio clip at the beginning of a certain scene, to play your animation in reverse, to loop certain sections of your animation, and so on.

Flash calls the chunks of ActionScript code you attach to your animation actions, which is a great reminder that ActionScript exists to help your audience interact with your animation.

Unfortunately, mastering a scripting language like ActionScript is a bit harder than mastering a regular programming language because you have to memorize not only the language itself (including syntax and basic programming concepts such as variables, functions, parameters, and so on) but also the scripting object model (the internal, Flash-designated names of all the parts of your animation and all ...

Get Flash 8: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.