Chapter 10. Dragging and Dropping

AIR's drag-and-drop Application Programming Interface (API) allows users to drag data between an AIR application and the desktop, between other applications, or within AIR itself from one component to another. The drag events are driven by and rely on both the AIR application and the user's operating system. AIR uses what are referred to as gestures to help communicate with an operating system to interpret the intentions of a user while data is being dragged and dropped.

A user drags an item by holding the mouse button down over a file, text selection, or application component and moving the mouse while holding the button down. The user drops the dragged data by releasing the mouse in a new location. Dragging-and-dropping is a common task used frequently in Windows, Mac, and Linux. A common use of dragging-and-dropping is to drag files to a folder or onto the desktop.

This chapter discusses the use of the drag-in and drag-out gestures in detail. ActionScript is the primary method here for using the API, and is followed by a section covering how the drag-in and drag-out gestures work in JavaScript.

Following the explanation of the API and various features of the drag-in and drag-out API, this chapter walks you through building a sample Tumblr client application to illustrate the use of these gestures. Tumblr is a microblogging Web service with a well-documented and simple API; it's well suited to demonstrate the usefulness of the drag-in API.

Drag and ...

Get Adobe® AIR™ Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.