6 Replies Latest reply on Feb 12, 2010 1:51 AM by SathyaShiva

    Native drag and drop troubles

      I'm having some trouble with my Flex/AIR app. I have a custom subclass of TileList onto which images can be dragged from the desktop. It worked fine with the old drag and drop system from earlier versions of the runtime but I can't get it to work now. I have tried using both DragManager and NativeDragManager, and while DragEvent.DRAG_ENTER and NativeDragEvent.NATIVE_DRAG_ENTER are both firing with no problem, the NativeDragEvent.NATIVE_DRAG_DROP and DragEvent.DRAG_DROP events never fire. The relevant sections of code are:
      In the constructor:

      addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER, dragIn);
      addEventListener(NativeDragEvent.NATIVE_DRAG_DROP, dragDrop);

      ..and the handlers...

      public function dragIn(event:NativeDragEvent):void {
      trace('drag in');
      trace('drag in accepted');

      public function dragDrop(event:NativeDragEvent):void {
      trace('drag drop'); //We never get here.
      var a:Array = event.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;
      dispatchEvent(new FileListEvent(FileListEvent.SELECT_MULTIPLE, false, false, a));

      The drag in event fires with no problem, but dragDrop is never called. Does anyone have any idea? Is this related to the fact that a TileList will already be watching for drag events so the tiles can be reordered? Thanks.