460
ActionScript classes
_droptarget (MovieClip._droptarget property)
public _droptarget :
String
[read-only]
Returns the absolute path in slash-syntax notation of the movie clip instance on which this
movie clip was dropped. The
_droptarget
property always returns a path that starts with a
slash (
/
). To compare the
_droptarget
property of an instance to a reference, use the
eval()
function to convert the returned value from slash syntax to a dot-syntax reference
(ActionScript 2.0 does not support slash syntax.)
Note:
This property is supported in Flash Lite only if
System.capabilities.hasMouse
is
true
or
System.capabilities.hasStylus
is
true
.
Availability:
ActionScript 1.0; Flash Lite 2.0
Example
The following example evaluates the
_droptarget
property of the
garbage_mc
movie clip
instance and uses
eval()
to convert it from slash syntax to a dot syntax reference. The
garbage_mc
reference is then compared to the reference to the
trashcan_mc
movie clip
instance. If the two references are equivalent, the visibility of
garbage_mc
is set to
false
. If
they are not equivalent, the
garbage
instance resets to its original position.
origX = garbage_mc._x;
origY = garbage_mc._y;
garbage_mc.onPress = function() {
this.startDrag();
};
garbage_mc.onRelease = function() {
this.stopDrag();
if (eval(this._droptarget) == trashcan_mc) {
this._visible = false;
} else {
this._x = origX;
this._y = origY;
}
};
See also
startDrag (MovieClip.startDrag method)
,
stopDrag (MovieClip.stopDrag
method)
,
eval function
Содержание Flash Lite 2
Страница 1: ...Flash Lite 2 x ActionScript Language Reference...
Страница 22: ...22 Contents...
Страница 244: ...244 ActionScript language elements...
Страница 760: ...760 ActionScript classes...