play( ) Global Function

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
play( ) Global Function Flash 2

begin the sequential display of frames in a movie (i.e., play the movie)
play()

Description

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 figs/u2192.gif Movie figs/u2192.gif 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 figs/u2192.gif Publish Settings figs/u2192.gif HTML figs/u2192.gif Playback figs/u2192.gif Loop. See Appendix H for more details.

Example

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.

See Also

gotoAndPlay( ), MovieClip.play( ), stop( )



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net