Name

MovieClip.gotoAndStop( ) Method — jump to a given frame, and stop the playhead

Availability

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

Synopsis

mc.gotoAndStop(frameNumber)
mc.gotoAndStop(frameLabel)

Arguments

frameNumber

A positive integer indicating the number of the frame to which the playhead of mc should jump. 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. If frameLabel is not found, the playhead is sent to the first frame of mc ’s timeline.

Description

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

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

Example

// Send the mainMenu clip to frame 6 and stop the playhead there
mainMenu.gotoAndStop(6);

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.