/ Published in: ActionScript 3

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// I Use this within my App Mediator, the view is the Application itself override public function onRegister() : void { eventMap.mapListener(view, NativeDragEvent.NATIVE_DRAG_ENTER, onDragIn); eventMap.mapListener(view, NativeDragEvent.NATIVE_DRAG_DROP, onDragDrop); } private function onDragIn(event:NativeDragEvent) : void { var url : String = event.clipboard.getData( ClipboardFormats.URL_FORMAT ) as String; var files : Array = event.clipboard.getData( ClipboardFormats.FILE_LIST_FORMAT ) as Array; if( ( files != null && files.length >= 0 ) || ( url != null ) ){ NativeDragManager.acceptDragDrop(contextView); } } private function onDragDrop(event:NativeDragEvent):void { var files : Array = event.clipboard.getData( ClipboardFormats.FILE_LIST_FORMAT ) as Array; var file:File = files[0]; if( file.url != null ){ dispatch(new SystemEvent(SystemEvent.LOAD_FILE, file.url)); } }
Comments
