O'Reilly logo

Flash 8 Cookbook by Joey Lott

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Managing Playback

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:

  1. An event occurs in the movie (examples include button presses, the playback of frames, movie clips being dragged, keypresses, and loaded data).

  2. An event handler associated with that event is triggered.

  3. 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required