User Guide
Basics for working with the core display classes 183
Controlling ActionScript 3.0 movie clips
Each MovieClip object has a timeline, and also includes properties and methods for
controlling the playhead and working with frames and scenes.
Many properties and methods of the ActionScript 1.0 and 2.0 MovieClip class are present as
properties or methods of the ActionScript 3.0 MovieClip class. Some are inherited from a
superclass. For example, the
x, y, and blendMode properties of the DisplayObject class, to
name a few, are valid for the MovieClip class because it extends the DisplayObject class.
However, some properties that had names that begin with the underscore character, such as
_x, _y, _root, have been renamed without the underscore in ActionScript 3.0. Also, the
_xmouse, _xscale, _ymouse, and _yscale properties have been renamed mouseX, scaleX,
mouseY, and scaleY.
The MovieClip class includes methods and properties for controlling the movie clip. The
following properties let you monitor the total number of frames and scenes in a movie clip
and monitor information about the frame and scene at the current playhead position:
currentFrame, currentLabel, currentLabels, currentScene, scenes, and totalFrames.
The following methods let you control the playhead for the movie clip:
gotoAndPlay(),
gotoAndStop(), nextFrame(), nextScene(), play(), prevFrame(), prevScene(), and
stop().
For example, the following code moves the playhead to the first frame of the current scene of
the
myMovie MovieClip object:
myMovie.gotoAndPlay(0);
For more information on these and other properties and methods, see the MovieClip section
of the ActionScript 3.0 Language Reference.
You can set the frame rate for all movie clips in an application using the
frameRate property
of the Stage object.
In contrast to ActionScript 1.0 and 2.0, a loaded SWF file in ActionScript 3.0 can be a
MovieClip object, an AVM1Movie object, or a Sprite object. However, in ActionScript 3.0
you can control the timeline only of a MovieClip object. Sprite and AVM1Movie objects do
not include timeline-related methods and properties.