In This Chapter
Understanding old and new ActionScript
Working on the Timeline
Using event listeners
Capturing mouse events
Creating functions for buttons
Controlling movie clips
ActionScript in Flash began as a way to control the Timeline of a Flash movie. Buttons, movie clips, and keyframes could all contain little bits of script. For example, you could assign a
gotoAndStop(12) statement to a button so that when that button is pressed, the playhead would move to Frame 12 and stop. Usually, the targets of the script were keyframes where new content would appear. The downside of this method is that each button required its own script, and as application sizes grew, so too did the complexity of working with all those little scripts.
With each new version of Flash, ActionScript improved, but nowhere near as dramatically as with ActionScript 3.0, where the language has been revised from top to bottom.
So that you can write more powerful ActionScript, Adobe modeled the latest release of ActionScript similar to other programming languages. Yes, we said the ugly word: programming. But before you run off and jump into cauldron of boiling oil as a pleasant alternative to programming, in this chapter we show what you can do with ActionScript 3.0 and (we hope!) convince you to give the latest version a try.