To use a method, invoke it by using the target path of the instance name, a dot, and then the
method name and parameters, as in the following statements:
myMovieClip.play();
parentClip.childClip.gotoAndPlay(3);
In the first statement,
statement,
gotoAndPlay()
) to Frame 3 and continues to move the playhead.
parentClip
Global functions that control a Timeline have a
target path to the instance that you want to control. For example, in the following script
targets the
startDrag()
on(press){
startDrag("customCursor");
}
The following functions target movie clips:
setProperty()
these functions, you must enter a target path for the function's
target of the function.
The following MovieClip methods can control movie clips or loaded levels and do not have
equivalent functions:
MovieClip.createTextField()
MovieClip.getBytesTotal()
MovieClip.getNextHighestDepth()
MovieClip.localToGlobal()
MovieClip.swapDepths()
For more information about these functions and methods, see
Dictionary," on page
Calling multiple methods on a single movie clip
You can use the
with
on that clip. The
and Sound), not just movie clips.
The
statement takes an object as a parameter. The object you specify is added to the end of
with
the current target path. All actions nested inside a
target path, or scope. For example, in the following script, the
to change the properties of
donut.hole
with (donut.hole){
_alpha = 20;
_xscale = 150;
_yscale = 150;
}
The script behaves as if the statements inside the
the
instance. The above code is equivalent to the following:
hole
donut.hole._alpha = 20;
donut.hole._xscale = 150;
donut.hole._yscale = 150;
122
Chapter 7: Working with Movie Clips
moves the playhead in the
play()
sends the playhead in
customCursor
,
,
startDrag()
duplicateMovieClip()
MovieClip.attachMovie()
,
MovieClip.getBounds()
,
MovieClip.getDepth()
,
MovieClip.hitTest()
.
205.
statement to address a movie clip once, and then execute a series of methods
statement works on all ActionScript objects (for example, Array, Color,
with
myMovieClip
childClip
parameter that allows you to specify the
target
instance and makes it draggable:
,
loadMovie()
unloadMovie()
, and
,
MovieClip.createEmptyMovieClip()
,
MovieClip.getInstanceAtDepth()
,
MovieClip.globalToLocal()
,
MovieClip.setMask()
statement are carried out inside the new
with
:
hole
statement were called from the Timeline of
with
instance. In the second
(which is a child of the instance
,
loadVariables()
removeMovieClip()
parameter to indicate the
target
,
MovieClip.getBytesLoaded()
,
,
Chapter 12, "ActionScript
statement is passed the object
with
,
. To use
,
,
,
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?