play( ) Global Function | Flash 2 |
begin the sequential display of frames in a movie (i.e., play the movie) |
Invoking the play( )
function initiates the sequential display of the frames in the
current timeline. The current timeline is the
timeline of the main movie or movie clip from which the
play( ) function was
invoked. Frames are displayed at a rate dictated by the frames per
second (or FPS) setting of the entire movie, which is set under the
Movie Properties (Modify Movie
Frame Rate). If the movie is already playing, invoking
play( ) has no effect.
Once started, the playback of a movie or movie clip continues until
another function invocation specifically stops the playback. All
movie clips loop (begin playing again at frame 1) when the playhead
reaches the end of the timeline. In a browser, however, main movies
loop only if the code used to embed the movie in the HTML page
specifies that the movie should loop, as determined by the
LOOP attribute. If you're using
the Publish command to embed your movie in an HTML page, set the
LOOP attribute by selecting File
Publish Settings
HTML
Playback
Loop. See Appendix H for more details.
Play the current timeline:
play()
Use the MovieClip.play( ) function instead of the legacy Tell Target action to instruct a different movie clip to play.
Reader Exercise: Write a recursive function, named allPlay( ), that plays the current timeline and recursively plays all nested movie clips contained within the current timeline.
gotoAndPlay( ), MovieClip.play( ), stop( )