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
this.onEnterFrame = function() {
my_mc._x = this._xmouse;
};
This is equivalent to the following code, which uses the
this.onEnterFrame = function() {
my_mc._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 "Property summary for the MovieClip class" in Flash
ActionScript Language Reference.
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 onto a specific movie clip (such as a "trash can" movie clip) and
then trigger another action, as shown in the following example:
//Drag a piece of garbage
garbage_mc.onPress = function() {
this.startDrag(false);
};
//When the garbage is dragged over the trashcan, make it invisible
garbage_mc.onRelease = function() {
this.stopDrag();
//convert the slash notation to dot notation using eval
if (eval(this._droptarget) == trashcan_mc) {
garbage_mc._visible = false;
}
};
For more information, see
Language Reference.
210
Chapter 8: Working with Movie Clips
_xmouse
instance to that value:
my_mc
,
,
_xscale
_yscale
,
_focusrect
_highquality
function or the
startDrag()
. Only one movie clip at a time can be dragged in a SWF file.
startDrag()
or
startDrag()
property on the current level's Timeline and
getProperty()
,
,
,
_height
_width
_alpha
,
_quality
MovieClip.startDrag()
stopDrag()
MovieClip.startDrag()
function:
, and
properties
_visible
, and
_soundbuftime
method to make
or until another movie
_droptarget
property to
_droptarget
in Flash ActionScript
property
Need help?
Do you have a question about the FLASH MX 2004-USING ACTIONSCRIPT IN FLASH and is the answer not in the manual?
Questions and answers