class org.aswing.dnd.DragManager
Drag and Drop Manager.
Thanks Bill Lee for the original DnD implementation for AsWing AS2 version.
@author palingClass Fields
static function addDragListener(lis:DragListener): Void
Adds a drag listener to listener list.
lis | the listener to be add |
static function getCurrentDropTarget(): DisplayObject
Returns current drop target of dragging components by startDrag method. @see #startDrag() @see #getDropTarget()
returns | the drop target |
static function getCurrentDropTargetComponent(): Component
Returns current drop target component of dragging components by startDrag method. @see #startDrag() @see #getDropTargetComponent()
returns | the drop target component |
static function getCurrentDropTargetDropTriggerComponent(): Component
Returns current drop target drop trigger component of dragging components by startDrag method. @see #startDrag() @see #getDropTargetDropTriggerComponent()
returns | the drop target drop trigger component |
static function getDropTarget(stage:Stage, ?pos:Point = null, ?targetType:Class<Dynamic> = null, ?addtionCheck:Dynamic ->Bool = null): DisplayObject
Returns the drop target of specified position and specified class type.
For example:
getDropTarget(new Point(0, 0), TextField); will return the first textfield insance under the point, or null if not found.getDropTarget(null, null); will return the first display object insance under the current mouse point, or null if not found.
stage | the stage where the drop target should be in |
pos | The point under which to look, in the coordinate space of the Stage. |
targetType | the class type of the target, default is null, means any display object. |
addtionCheck, | a check function, only return the target when function(target:DisplayOject) return true. default is null, means no this check. |
returns | drop target |
static function getDropTargetComponent(?pos:Point = null): Component
Returns current drop target component of specified position. @see #startDrag() @see #getDropTargetComponent()
pos | the global point |
returns | the drop target component |
static function getDropTragetDropTriggerComponent(?pos:Point = null): Component
Returns drop target drop trigger component of specified global position. @see #startDrag() @see #getDropTargetDropTriggerComponent()
pos | the point |
returns | the drop target drop trigger component |
static function removeDragListener(lis:DragListener): Void
Removes the specified listener from listener list.
lis | the listener to be removed |
static function setDragingImageContainerRoot(theRoot:DisplayObjectContainer): Void
Sets the container to hold the draging image(in fact it will hold the image's parent--a sprite).
By default(if you have not set one), it will be the AsWingManager.getRoot()
value.
@see org.aswing.AsWingManager#getRoot()
theRoot | the container to hold the draging image. |
static function setDropMotion(motion:DropMotion): Void
Sets the motion of drag movie clip when a drop acted.
Generally if you want to do a custom motion of the dragging movie clip when dropped, you may
call this method in the listener's onDragDrop()
method.
Every drop acted, the default motion will be set to DirectlyRemoveMotion
so you need to set to yours every drop time if you want.
@see org.aswing.dnd.DropMotion
@see org.aswing.dnd.DirectlyRemoveMotion
@see org.aswing.dnd.RejectedMotion
@see org.aswing.dnd.DragListener#onDragDrop()
motion | the motion |
static function startDrag(dragInitiator:Component, sourceData:SourceData, ?dragImage:DraggingImage = null, ?dragListener:DragListener = null): Void
startDrag(dragInitiator:Component, dragSource, dragImage:MovieClip, lis:DragListener)
startDrag(dragInitiator:Component, dragSource, dragImage:MovieClip)
startDrag(dragInitiator:Component, dragSource)
Starts dragging a initiator, with dragSource, a dragging Image, and a listener. The drag action will be finished at next Mouse UP/Down Event(Mouse UP or Mouse Down, generally you start a drag when mouse down, then it will be finished when mouse up, if you start a drag when mouse up, it will be finished when mouse down).
dragInitiator | the dragging initiator |
sourceData | the data source will pass to the listeners and target components |
dragImage | (optional)the image to drag, default is a rectangle image. |
dragListener | (optional)the listener added to just for this time dragging action, default is null(no listener) |