I was sitting here at 360Flex|Milan and I had a conversation with Michael Labriola about DragManagers in AIR. We both lamented that in Flexbuilder 3 beta 2, we were able to use both the NativeDragManager and the DragManager at the same time (albeit it was a bit hacky). In an earlier post, I demonstrated a MonkeyPatch that allowed you to use the Flex DragManager inside a WindowedApplication in AIR. This was great, but you lose the ability to use Native Dragging/Dropping in your AIR app. This evening, I was finally pissed off enough to rewrite the DragManager how I think Adobe SHOULD have done it in the first place. You use the DragManager class for both Native and Flex-based drag/drop and it’ll pretty much figure out which one you wanted to use. If you’re doing manual Native dragging OUT of your app, the doDrag() method has an additional boolean value at the end to specify that it’s supposed to begin a native drag operation. I’m not going to go into a ton of detail on how it was done, but the code is posted below with view-source enabled. DragManager and SystemManager have been MonkeyPatched.  It’s been liberally commented, so hopefully you can figure it out. Post a comment if you have trouble with it or it screws up because I missed catching a bug here or there.

DualDragManagers.air

Posted by Andrew, filed under 360 Flex, AIR, MonkeyPatch. Date: April 8, 2008, 4:08 pm |

Leave a Comment

Your comment

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.