Name

MovieClip.gotoAndPlay( ) Method — jump to a given frame, then play

Availability

Method form introduced in Flash 5 (global form supported by Flash 2 and later)

Synopsis

mc.gotoAndPlay(frameNumber)
mc.gotoAndPlay(frameLabel)

Arguments

frameNumber

A positive integer indicating the number of the frame to which the playhead of mc should jump before playing. If frameNumber is less than 1 or greater than the number of frames in mc ’s 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 mc should jump before playing. If frameLabel is not found, the playhead is sent to the first frame of mc ’s timeline.

Description

The MovieClip.gotoAndPlay( ) method is an alternative to the global gotoAndPlay( ) function. Use the method form to control remote movie clips or movies, specified by mc.

For general usage instructions, see the global gotoAndPlay( ) function.

Example

// Send the part1 clip to the label intro, then play part1
part1.gotoAndPlay("intro");

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.