Lingo Dictionary > O-R > play |  |

play

Syntax

    sprite(whichFlashSprite).play()
    play [frame] whichFrame
    play movie whichMovie
    play frame whichFrame of movie whichMovie
    play sprite whichFlashSprite

Description

Command; branches the playback head to the specified frame of the specified movie or starts a Flash movie sprite playing. For the former, the expression `whichFrame` can be either a string marker label or an integer frame number. The expression `whichMovie` must be a string that specifies a movie file. When the movie is in another folder, `whichMovie` must specify a path.

The `play` command is like the `go to` command, except that when the current sequence finishes playing, `play` automatically returns the playback head to the frame where `play` was called.

If `play` is issued from a frame script, the playback head returns to the next frame; if `play` is issued from a sprite script or handler, the playback head returns to the same frame. A play sequence ends when the playback head reaches the end of the movie or when the `play done` command is issued.

To play a movie from a URL, use `downloadNetThing` or `preloadNetThing()` to download the file to a local disk first, and then use `play` to play the movie on the local disk to minimize download time.

You can use the `play` command to play several movies from a single handler. The handler is suspended while each movie plays but resumes when each movie is finished. Contrast this with a series of `go` commands that, when called from a handler, play the first frame of each movie. The handler is not suspended while the movie plays but immediately continues executing.

When `play` is used to play a Flash movie sprite, the Flash movie plays from its current frame if it is stopped or from its first frame if it is already on the last frame.

Each `play` command needs a matching `play done` command to avoid using up memory if the original calling script isn't returned to. To avoid this memory consumption, you can use a global variable to record where the movie should return to.

Example

This statement moves the playback head to the marker named blink:

    play "blink"

Example

This statement moves the playback head to the next marker:

    play marker(1)

Example

This statement moves the playback head to a separate movie:

    play movie "My Drive:More Movies:" & newMovie

Example

This frame script checks to see if the Flash movie sprite in channel 5 is playing, and if it is not, it starts the movie:

    on enterFrame
    	if not sprite(5).playing then
    		sprite(5).play()
    	end if
    end

See also

`downloadNetThing`