/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import flash.desktop.NativeDragManager; import flash.events.NativeDragEvent; import flash.desktop.ClipboardFormats; this.addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER,onDragEnter); this.addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER,onDragDrop); function onDragEnter (e:NativeDragEvent):void { var fa:Object = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT); if (fa[0].extension == "jpg") { NativeDragManager.acceptDragDrop(this); } } function onDragDrop (e:NativeDragEvent):void { var fa:Object = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT); uildr.source = fa[0].url; }