Name

gotoAndPlay( ) Global Function — move the playhead to a given frame, then play the current clip or movie

Availability

Flash 2 and later

Synopsis

gotoAndPlay(frameNumber)
gotoAndPlay(frameLabel)
gotoAndPlay(scene, frameNumber)
gotoAndPlay(scene, frameLabel)

Arguments

frameNumber

A positive integer indicating the number of the frame to which the playhead of the current timeline should proceed before playing. If frameNumber is less than 1 or greater than the number of frames in the timeline, the playhead is sent to either the first or last frame, respectively.

frameLabel

A string indicating the label of the frame to which the playhead of the current timeline should proceed before playing. If frameLabel is not found, the playhead is sent to the first frame of the timeline.

scene

An optional string indicating the name of the scene that contains the specified frameNumber or frameLabel. If not supplied, the current scene is assumed.

Description

When invoked without a scene argument, gotoAndPlay( ) sends the playhead of the current timeline to the frame specified by either the frameNumber or frameLabel and then plays the timeline from that point. The “current timeline” is the movie clip or movie from which the gotoAndPlay( ) function is invoked.

If two arguments are specified in the gotoAndPlay( ) function call, the first argument is assumed to be the scene. If only one argument is specified, it is treated as a frameNumber or frameLabel, and the current scene is assumed.

When invoked with a scene ...

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.