Understanding the ActionScript Language > About scripting in ActionScript > About the MovieClip object |
![]() ![]() ![]() |
About the MovieClip object
In the Actions panel, the built-in ActionScript classes are called objects. You can think of an object as a class instance that allows you to access a certain type of information. For example, a Date object has methods that allow you to read information from the system clock (for example, getFullYear
, getMonth
). A Sound object has methods that allow you to control a sound in a movie (for example, setVolume
, setPan
). A MovieClip object has methods that allow you to control movie clip instances (for example, play
, stop
, and getURL
) and get and set their properties (for example, _alpha
, _framesloaded
, _visible
).
Movie clips are the most important objects of a Flash movie because they are mini-Flash movies: they have Timelines that run independently of each other. For example, if the main Timeline only has one frame and a movie clip in that frame has ten frames, each frame in the movie clip plays when you play the main movie. This allows instances to act as autonomous objects that can communicate with each other.
Movie clip instances each have a unique instance name so that you can target them with an action. For example, you may have multiple instances on the Stage (for example, leftClip
and rightClip
) and only want one to play at a time. To assign an action that tells one particular instance to play, you need to use its name. In the following example, the movie clip's name is leftClip
:
leftClip.play();
Instance names also allow you to duplicate, remove, and drag movie clips while a movie plays. Movie clips have properties whose values you can set and retrieve dynamically with ActionScript. Changing and reading these properties can alter the appearance and identity of a movie clip and is the key to creating interactivity. For example, the following script uses the setProperty
action to set the transparency (alpha setting) of the navigationBar
instance to 10:
setProperty("navigationBar", _alpha, 10);
Buttons and text fields in a Flash movie are also objects that you can manipulate with ActionScript.For more information, see Working with Movie Clips and Buttons.
![]() ![]() ![]() |