Hi,
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');
if(event.clipboard.hasFormat(ClipboardFormats.FILE_LIST_FORMAT)){
trace('drag in accepted');
NativeDragManager.acceptDragDrop(this);
this.drawFocus(true);
}
}
public function dragDrop(event:NativeDragEvent):void {
trace('drag drop'); //We never get here.
if(event.clipboard.hasFormat(ClipboardFormats.FILE_LIST_FORMAT)){
var a:Array = event.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;
dispatchEvent(new FileListEvent(FileListEvent.SELECT_MULTIPLE, false, false, a));
this.drawFocus(false);
}
}
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.
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');
if(event.clipboard.hasFormat(ClipboardFormats.FILE_LIST_FORMAT)){
trace('drag in accepted');
NativeDragManager.acceptDragDrop(this);
this.drawFocus(true);
}
}
public function dragDrop(event:NativeDragEvent):void {
trace('drag drop'); //We never get here.
if(event.clipboard.hasFormat(ClipboardFormats.FILE_LIST_FORMAT)){
var a:Array = event.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;
dispatchEvent(new FileListEvent(FileListEvent.SELECT_MULTIPLE, false, false, a));
this.drawFocus(false);
}
}
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.