Working with Movie Clips > Using actions and methods to control Timelines
Using actions and methods to control Timelines
You can use certain actions and methods of the MovieClip object to target, or perform tasks on, a movie clip or loaded level. For example, the setProperty
action sets a property (such as _width
) of a Timeline to a value (such as 100
). Some MovieClip object methods duplicate the function of all the actions that target Timelines. There are also additional methods, such as hitTest
, and swapDepths
. Whether you use an action or a method, the target Timeline must be loaded in the Flash Player when the action or method is called.
The following actions can target movie clips: loadMovie
, unloadMovie
, setProperty
, startDrag
, duplicateMovieClip
, and removeMovieClip
. To use these actions, you must enter a target path in the action's Target parameter to indicate the recipient of the action. Some of these actions can target movie clips or levels and others can only target movie clips.
The following MovieClip object methods can control movie clips or loaded levels and do not have equivalent actions: attachMovie
, getBounds
, getBytesLoaded
, getBytesTotal
, globalToLocal
, localToGlobal
, hitTest
, and swapDepths
.
When an action and a method offer similar functions, you can choose to control movie clips by using either one. The choice depends on your preference and familiarity with writing scripts in ActionScript.
For more information about the methods of the MovieClip object and for information about each action, see Chapter 7, "ActionScript Dictionary"