Changing movie clip position and appearance
To change the properties of a movie clip as it plays, write a statement that assigns a value to a
property or use the
instance
to 45:
mc
mc._rotation = 45;
This is equivalent to the following code, which uses the
setProperty("mc", _rotation, 45);
Some properties, called read-only properties, have values that you can read but not set. (These
properties are specified as read-only in their ActionScript Dictionary entries.) The following are
read-only properties:
,
_totalframes
You can write statements to set any property that is not read-only. The following statement sets
the
property of the movie clip instance
_alpha
car.wheel._alpha = 50;
In addition, you can write statements that get the value of a movie clip property. For example, the
following statement gets the value of the
sets the
property of the
_x
onClipEvent(enterFrame){
customCursor._x = _root._xmouse;
}
This is equivalent to the following code, which uses the
onClipEvent(enterFrame){
customCursor._x = getProperty(_root, _xmouse);
}
The
,
,
_x
_y
_rotation
are affected by transformations on the movie clip's parent, and transform the movie clip and any
of the clip's children. The
properties are global; they belong only to the level 0 main Timeline. All other properties belong to
each movie clip or loaded level.
For a list of movie clip properties, see
Dragging movie clips
You can use the global
a movie clip draggable. For example, you can make a draggable movie clip for games, drag-and-
drop functions, customizable interfaces, scroll bars, and sliders.
A movie clip remains draggable until explicitly stopped by
clip is targeted with
To create more complicated drag-and-drop behavior, you can evaluate the
of the movie clip being dragged. For example, you might examine the
see if the movie clip was dragged to a specific movie clip (such as a "trash can" movie clip) and
then trigger another action. For detailed information, see
MovieClip.startDrag()
function. For example, the following code sets the rotation of
setProperty()
,
_currentframe
,
, and
_url
_xmouse
_ymouse
customCursor
,
,
_xscale
_yscale
_focusrect
"Property summary for the MovieClip class" on page
function or the
startDrag()
. Only one movie clip can be dragged at a time.
startDrag()
on page
534.
setProperty()
,
_droptarget
_framesloaded
.
, which is a child of the
wheel
property on the current level's Timeline and
_xmouse
instance to that value:
getProperty()
,
,
_height
_width
,
,
_highquality
_quality
MovieClip.startDrag()
stopDrag()
startDrag()
function:
,
,
_parent
_target
instance:
car
function:
,
, and
_alpha
_visible
, and
_soundbuftime
method to make
, or until another movie
_droptarget
_droptarget
on page 645
Dragging movie clips
,
properties
484.
property
property to
or
125
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?