Adobe has a great article over at the Flex Developer Center on how to add drag-and-drop support to your Flex application:
This article provides a great foundation for developers who want to learn how drag-and-drop works inside Flex.
However all their examples use what’s called a “drag proxy” for their drag operations, which is pretty weak if you want a true drag-and-drop look-and-feel in your application.
The problem with using a drag proxy is that the object being dragged looks like it’s being copied instead of dragged. The original object is only moved after the drag operation is complete.
That may be good enough for some applications, but when you want your objects to look like they’re being moved in real-time, this “copy effect” just doesn’t cut it.
So let’s take a look at what goes into a drag operation.
The first parameter in the
DragManager.doDrag() method is the
dragInitiator. This is the component that started the drag operation.
As it turns out, the
dragInitiator is all you need to improve the look-and-feel of your drag operations.
If you pass the
dragInitiator in as the
dragImage for your drag operation, the
DragManager will drag the component directly!
How’s that for simple?