Package | mx.managers |
Class | public class DragManager |
All methods and properties of the DragManager are static, so you do not need to create an instance of it.
All Flex components support drag and drop operations. Flex provides additional support for drag and drop to the List, Tree, and DataGrid controls.
When the user selects an item with the mouse, the selected component is called the drag initiator. The image displayed during the drag operation is called the drag proxy.
When the user moves the drag proxy over another component,
the dragEnter
event is sent to that component.
If the component accepts the drag, it becomes the drop target
and receives dragOver
, dragExit
,
and dragDrop
events.
When the drag is complete, a dragComplete
event
is sent to the drag initiator.
See also
Property | Defined by | ||
---|---|---|---|
isDragging : Boolean [static][read-only]
Read-only property that returns
true
if a drag is in progress. | DragManager |
Method | Defined by | ||
---|---|---|---|
acceptDragDrop(target:IUIComponent):void
[static]
Call this method from your
dragEnter event handler if you accept
the drag/drop data. | DragManager | ||
doDrag(dragInitiator:IUIComponent, dragSource:DragSource, mouseEvent:MouseEvent, dragImage:IFlexDisplayObject = null, xOffset:Number = 0, yOffset:Number = 0, imageAlpha:Number = 0.5, allowMove:Boolean = true):void
[static]
Initiates a drag and drop operation.
| DragManager | ||
getFeedback():String
[static]
Returns the current drag and drop feedback.
| DragManager | ||
showFeedback(feedback:String):void
[static]
Sets the feedback indicator for the drag and drop operation.
| DragManager |
Constant | Defined by | ||
---|---|---|---|
COPY : String = "copy" [static]
Constant that specifies that the type of drag action is "copy".
| DragManager | ||
LINK : String = "link" [static]
Constant that specifies that the type of drag action is "link".
| DragManager | ||
MOVE : String = "move" [static]
Constant that specifies that the type of drag action is "move".
| DragManager | ||
NONE : String = "none" [static]
Constant that specifies that the type of drag action is "none".
| DragManager |
isDragging | property |
isDragging:Boolean
[read-only]
Read-only property that returns true
if a drag is in progress.
public static function get isDragging():Boolean
acceptDragDrop | () | method |
public static function acceptDragDrop(target:IUIComponent):void
Call this method from your dragEnter
event handler if you accept
the drag/drop data.
For example:
DragManager.acceptDragDrop(event.target);Parameters
target:IUIComponent — The drop target accepting the drag.
|
doDrag | () | method |
public static function doDrag(dragInitiator:IUIComponent, dragSource:DragSource, mouseEvent:MouseEvent, dragImage:IFlexDisplayObject = null, xOffset:Number = 0, yOffset:Number = 0, imageAlpha:Number = 0.5, allowMove:Boolean = true):void
Initiates a drag and drop operation.
ParametersdragInitiator:IUIComponent — IUIComponent that specifies the component initiating
the drag.
|
|
dragSource:DragSource — DragSource object that contains the data
being dragged.
|
|
mouseEvent:MouseEvent — The MouseEvent that contains the mouse information
for the start of the drag.
|
|
dragImage:IFlexDisplayObject (default = null ) — The image to drag. This argument is optional.
If omitted, a standard drag rectangle is used during the drag and
drop operation. If you specify an image, you must explicitly set a
height and width of the image or else it will not appear.
|
|
xOffset:Number (default = 0 ) — Number that specifies the x offset, in pixels, for the
dragImage . This argument is optional. If omitted, the drag proxy
is shown at the upper-left corner of the drag initiator. The offset is expressed
in pixels from the left edge of the drag proxy to the left edge of the drag
initiator, and is usually a negative number.
|
|
yOffset:Number (default = 0 ) — Number that specifies the y offset, in pixels, for the
dragImage . This argument is optional. If omitted, the drag proxy
is shown at the upper-left corner of the drag initiator. The offset is expressed
in pixels from the top edge of the drag proxy to the top edge of the drag
initiator, and is usually a negative number.
|
|
imageAlpha:Number (default = 0.5 ) — Number that specifies the alpha value used for the
drag image. This argument is optional. If omitted, the default alpha
value is 0.5. A value of 0.0 indicates that the image is transparent;
a value of 1.0 indicates it is fully opaque.
|
|
allowMove:Boolean (default = true ) — Indicates if a drop target is allowed to move the dragged data.
|
getFeedback | () | method |
public static function getFeedback():String
Returns the current drag and drop feedback.
ReturnsString — Possible return values are DragManager.COPY ,
DragManager.MOVE ,
DragManager.LINK , or DragManager.NONE .
|
showFeedback | () | method |
public static function showFeedback(feedback:String):void
Sets the feedback indicator for the drag and drop operation.
Possible values are DragManager.COPY
, DragManager.MOVE
,
DragManager.LINK
, or DragManager.NONE
.
feedback:String — The type of feedback indicator to display.
|
COPY | constant |
public static const COPY:String = "copy"
Constant that specifies that the type of drag action is "copy".
LINK | constant |
public static const LINK:String = "link"
Constant that specifies that the type of drag action is "link".
MOVE | constant |
public static const MOVE:String = "move"
Constant that specifies that the type of drag action is "move".
NONE | constant |
public static const NONE:String = "none"
Constant that specifies that the type of drag action is "none".