Skip to Main Content
Adobe AIR 1.5 Cookbook
book

Adobe AIR 1.5 Cookbook

by Rich Tretola, David Tucker, Marco Casario, Koen DeWeggheleire, Koen De Weggheleire
November 2008
Beginner to intermediate content levelBeginner to intermediate
446 pages
10h 38m
English
O'Reilly Media, Inc.
Content preview from Adobe AIR 1.5 Cookbook

Chapter 8. Drag and Drop Support

Because almost every graphical operating system environment supports some level of drag and drop functionality, AIR provides an easy way to work with drag and drop gestures across multiple platforms. AIR supports both the dragging out and the dropping in of the standard data types; however, ActionScript and JavaScript deal with these gestures in very different ways.

Dragging Data Out of an Application in ActionScript

Problem

You need to drag a file reference from your application to the desktop.

Solution

Use the NativeDragManager class to control the drag-in gesture in your AIR application.

Discussion

In ActionScript, you manage drag and drop gestures with the NativeDragManager class. To support a drag-out gesture specifically, you use the doDrag static method of the NativeDragManager class. You can pass in five parameters; the first two are required: dragInitiator and clipboard.

The first required parameter, dragInitiator, is the object that initiated the drag action. It is required to be an InteractiveObject or a class that inherits from it. The second parameter, clipboard, is an instance of the Clipboard class or a class inheriting from the Clipboard class. In this case, you actually need to instantiate an instance of the Clipboard class and add the data that needs to be passed with the drag-out gesture.

In this example, the user interface consists of a label, a button, and a list:

<mx:Label id="directoryName" fontSize="20" fontWeight="bold" /> <mx:Button ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Breaking Out of the Web Browser with Adobe AIR

Breaking Out of the Web Browser with Adobe AIR

Jeff Tapper, Michael Labriola, Peter Dilillo, Tom Kaczanko, Andriy Kupriyenko, Louie Penaflor, Mike Nimer, Nathan Weber, Steve Zimmers
Adobe AIR Programming Unleashed

Adobe AIR Programming Unleashed

Stacy Tyler Young, Michael Givens, Dimitrios Gianninas

Publisher Resources

ISBN: 9780596156145Supplemental ContentErrata Page