Revision: 39914
Updated Code
at January 22, 2011 13:44 by momothemonster
Updated Code
// 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)); } }
Revision: 39913
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 22, 2011 13:43 by momothemonster
Initial Code
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)); } }
Initial URL
Initial Description
Initial Title
AS3 Air Drag and Drop within Robotlegs
Initial Tags
Initial Language
ActionScript 3