Posted By

sidneydekoning on 05/14/09


Tagged


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

toxin20
iamgowan
donaldleegraham


Drag and Drop in AIR


 / Published in: ActionScript 3
 

  1. import flash.desktop.NativeDragManager;
  2. import flash.events.NativeDragEvent;
  3. import flash.desktop.ClipboardFormats;
  4.  
  5. this.addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER,onDragEnter);
  6. this.addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER,onDragDrop);
  7.  
  8. function onDragEnter (e:NativeDragEvent):void {
  9. var fa:Object = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT);
  10. if (fa[0].extension == "jpg") {
  11. NativeDragManager.acceptDragDrop(this);
  12. }
  13. }
  14.  
  15. function onDragDrop (e:NativeDragEvent):void {
  16. var fa:Object = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT);
  17. uildr.source = fa[0].url;
  18. }

Report this snippet  

You need to login to post a comment.