Wiki
Clone wikidsair / DragDropManager
HOWTO: DragDropManager: Dragging and dropping files from the desktop to your app.
Introduction
The DragDropManager
deals with dragging and dropping (multiple) files from the desktop to your app. You can use it to easily load/process files.
Details
Check out the TestDragDrop.as file for the full details.
As with all examples, you need to init the framework before doing anything:
#!actionscript DSAir.init( this ); // "this" is your Document class
##Creating your drop target##
Any object that you want to act as the drop target for your files, firstly needs to be an InteractiveObject
, and secondly needs to implement the IDragDrop
interface.
This specifies the 3 functions to call for your drop target: onDragOver()
for when we drag files over the drop target, onDragOut()
for when we drag files out of the drop target having previously been over it, and onDragDrop( files:Array )
for when we drop our files onto the target. The files
Array is an Array of File
objects that match the files that we dragged.
##Initing the drop target##
After you've created your object that implements IDragDrop
, simply call
#!actionscript DragDropManager.instance.target = target;
to init it.
Updated