1 Reply Latest reply on Oct 19, 2010 3:29 PM by Flex harUI

    Native Drag and Drop Operation

    l33tian

      Hi guys...I am trying to drag an Image from my computer's desktop into an <mx:image> Control with id logoImage...I tried listening for NativedragDrop, NativeDragExit and NativeDragEnter Events on the Image Control directly and putting the my required logic like so:

       

      protected function image1_nativeDragEnterHandler(event:NativeDragEvent):void

      {

           if(event.clipboard.hasFormat(ClipboardFormats.FILE_LIST_FORMAT))

           {

                var files:Array=event.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array

                if(files.length==1)

                {

                     DragManager.acceptDragDrop(event.currentTarget as IUIComponent);

                }

           }

      }

       

       

      protected function image1_nativeDragDropHandler(event:NativeDragEvent):void

      {

           Alert.show("You have droped Something on me")

           var files:Array=event.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;

           logoImage.source=(files[0] as File).url;

      }

      but it doesnt seem to work...is something wrong somewhere?