
MovieClip.duplicateMovieClip() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
650
|
ActionScript Language Reference
Description
If mc is being dragged, _droptarget returns a string indicating the path to the clip over
which
mc hovers (if any). If mc is not hovering over a clip, _droptarget returns undefined.If
mc was previously dragged and then dropped on a clip, _droptarget returns a string indi-
cating the path to the clip upon which
mc was dropped. The path is provided in slash
notation. A movie clip is considered to be “over” another clip if the mouse pointer over-
laps any portion of the target clip. If
mc hovers over two or more overlapping clips, only the
topmost clip is considered the
_droptarget. To detect intersection between any number of
overlapping clips, use MovieClip.hitTest().
Example
The _droptarget property is convenient for creating drag-and-drop interfaces. The following
example demonstrates how to create a simple shopping-basket interface using
_droptarget.
When the
item_mc clip is dropped onto the basket clip, it is allowed to stay in the basket;
otherwise, the
item_mc is returned to its original location:
// Set original location
item_mc.origX = _x;
item_mc.origY = _y;
// Define a function to call when the item is clicked
item_mc.drag = function () {
this.startDrag();
}
// Define a function to call when the item is ...