O'Reilly logo

Essential ActionScript 3.0 by Colin Moock

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

Programmatic Timeline Control

Now that we know how to access manually created Movie Clip symbol instances, let's take a quick look at the tools for controlling the playback of those instances. The following list describes the most important timeline-control methods and variables of the MovieClip class. For more information on the MovieClip class, see Adobe's ActionScript Language Reference.

play( )

Initiates the sequential display of the frames the movie clip's timeline. Frames are displayed at a speed dictated by the frame rate, which can be assigned via the Flash runtime Stage instance's frameRate variable.

stop( )

Halts the playback of a movie clip. But note that even while a movie clip is stopped, the Flash runtime continues to play sounds, react to user actions, and process events, including Event.ENTER_FRAME events. Similarly, visual changes performed in event handlers or via setInterval( ) or a Timer event are rendered even when the playhead is stopped. The stop( ) method merely prevents the movie clip's playhead from advancing in the timeline.

gotoAndPlay( )

Sends the playhead of the movie clip's timeline to the specified frame number or label and then plays the timeline from that point. The state of other movie clips is not affected. To cause other movie clips to play, invoke play( ) or gotoAndPlay( ) separately on each movie clip.

gotoAndStop( )

Sends the playhead of the movie clip's timeline to the specified frame number or label and then halts the playback of the movie clip. ...

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