Drag and Drop | 109
TIP
Adobe AIR’s support for drag and drop is based on the
WebKit implementation. You can find more information
on this at: http://developer.apple.com/documentation/
AppleApplications/Conceptual/SafariJSProgTopics/Tasks/
DragAndDrop.html.
Discussion
One of the benefits of developing for the desktop is provid-
ing users with a more integrated experience when interacting
with multiple applications. One of the most frequently used
user gestures is to drag and drop files, data, and other ele-
ments between applications and the desktop and between
the applications themselves.
This example will demonstrate how you can accept text
being dragged into your application and also support drag-
ging text out. It will also show you how to modify the drag
effect in order to demonstrate for the user what type of drag
operations he can perform with the element he is dragging.
There are two flows that are important to consider when
using drag and drop operations in HTML. First we will
examine the flow for HTML elements that want to allow
themselves to be dragged by users:
1.Element specifies that it is available for drag operations.
2.User selects the item and starts dragging it.
3.Element receives anondragstartevent and sets the data
which will be transferred and also specifies which drag
operations are supported.
4.Element receivesondragevents while the element is being
dragged.
5.User drops the item being dragged and the initiating ele-
ment receives anondragend event.