Following is the excerpts from Adobe Flex Docs
The drag-and-drop operation
The following steps define the drag-and-drop operation.
- A component becomes a drag-and-drop initiator in either of the following ways:
- List-based components with dragEnabled=true
Flex automatically makes the component an initiator when the user clicks and moves the mouse on the component.
- Nonlist-based components, or list-based components with dragEnabled=false
The component must detect the user's attempt to start a drag operation and explicitly become an initiator. Typically, you use the mouseMove or mouseDown event to start the drag-and-drop operation.
The component then creates an instance of the mx.core.DragSource class that contains the data to be dragged, and specifies the format for the data.
The component then calls the mx.managers.DragManager.doDrag() method, to initiate the drag-and-drop operation.
- While the mouse button is still pressed, the user moves the mouse around the application. Flex displays the drag proxy image in your application. TheDragManager.defaultDragImageSkin property defines the default drag proxy image.
You can define your own drag proxy image. For more information, see Example: Specifying the drag proxy.
Note: Releasing the mouse button when the drag proxy is not over a target ends the drag-and-drop operation. Flex generates a DragComplete event on the drag initiator, and the DragManager.getFeedback() method returns DragManager.NONE.
- If the user moves the drag proxy over a Flex component, Flex dispatches a dragEnter event for the component.
The dragEnter event handler can examine the DragSource object to determine whether the data being dragged is in an accepted format. To accept the drop, the event handler calls the DragManager.acceptDragDrop() method. You must call the DragManager.acceptDragDrop() method for the drop target to receive the dragOver,dragExit, and dragDrop events.
- If the drop target does not accept the drop, the drop target component's parent chain is examined to determine if any component in the chain accepts the drop data.
- If the drop target or a parent component accepts the drop, Flex dispatches the dragOver event as the user moves the proxy over the target.
- (Optional) The drop target can handle the dragOver event. For example, the drop target can use this event handler to set the focus on itself.
- (Optional) If the user decides not to drop the data onto the drop target and moves the drag proxy outside of the drop target without releasing the mouse button, Flex dispatches a dragExit event for the drop target. The drop target can optionally handle this event; for example, to undo any actions made in the dragOver event handler.
- If the user releases the mouse while over the drop target, Flex dispatches a dragDrop event on the drop target.
- List-based components with dropEnabled=true
Flex automatically adds the drag data to the drop target. If this is a copy operation, you have to implement the event handler for the dragDrop event for a list-based control. For more information, see Example: Copying data from one List control to another List control.
- Nonlist-based components, or list-based components with dropEnabled=false
The drop target must define an event listener for the dragDrop event handler to add the drag data to the drop target.
- (Optional) When the drop operation completes, Flex dispatches a dragComplete event. The drag initiator can handle this event; for example, to delete the drag data from the drag initiator in the case of a move.
- List-based components with dragEnabled=true
If this is a move operation, Flex automatically removes the drag data from the drag initiator.
- Nonlist-based components, or list-based components with dragEnabled=false
The drag initiator completes any final processing required. If this was a move operation, the event handler must remove the drag data from the drag initiator. For an example of writing the event handler for the dragComplete event, see Example: Moving and copying data for a nonlist-based control.