View comments | RSS feed

MovieClip._droptarget

Availability

Flash Player 4.

Usage

my_mc._droptarget:String

Description

Read-only property; returns the absolute path in slash syntax notation of the movie clip instance on which my_mc 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.

Note: You must perform this conversion if you are using ActionScript 2.0, which does not support slash syntax.

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(), stopDrag()

Comments


sebasporto said on Jul 19, 2005 at 12:58 AM :
Note that _droptarget only works if a startDrag() command has been invoked previously
Mr_Rowsell said on Aug 3, 2005 at 4:58 PM :
Why does _droptarget still return a path in slash syntax? Is there no updated method for checking where a movie is dropped on stopDrag()? Has this simply been overlooked? As far as I have seen every other non-deprecated property has been updated to dot syntax, even before the addition of actionscript 2.0.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001495.html