By default, a Flash movie begins playback as soon as it loads, playing through the end of the movie, and looping back to the beginning and playing again. Unless you are making a simple animation, you’ll probably want to control playback or enable user control. For example, most interactive movies, such as games and business or learning applications, need to stop on the first frame (or the first frame following a preloader). Even for animations and video, you’ll often need to provide playback control buttons for the user. Flash has several ActionScript methods for controlling playback, including pausing and starting playback, skipping to different portions of the movie, and advancing the playhead one frame at a time. These include stop( ), gotoAndPlay( ), gotoAndStop( ), nextFrame( ), prevFrame( ), nextScene( ), and prevScene( ). Fortunately, these methods are easy to implement.
To script in Flash, you must understand the relationship between events that occur in the movie and ActionScript statements associated with them. Every script executed in Flash occurs in the same sequence:
An event occurs in the movie (examples include button presses, the playback of frames, movie clips being dragged, keypresses, and loaded data).
An event handler associated with that event is triggered.
The actions or statements enclosed in that event handler are executed.
If a series of actions is enclosed in an event handler, and the corresponding event never occurs, the script ...