2 Replies Latest reply on Feb 26, 2008 11:29 AM by ctzn99

    Native vs. "Regular" DragDropping

    ctzn99 Level 1
      So, I've got a "file manager" application. Previously it was a flex 2.0.1 (and still is until i get this working) app, basically it had a file tree that represented files on a server. I can drag and drop and move the files around on the tree, doing this invokes a series of web service methods and the changes get reflected on the server. I can also use the file upload dialog to upload files. In the current incarnation I'm using, of course, just DragEvents.

      My biggest complaint from clients is the lack of ability to drag and drop files from the desktop. I converted my Application to a WindowApplication and changed a few things to make it work off the desktop (checking connectivity, using a local config file, etc) and everything works. I am now trying to add the ability to drag and drop files from the desktop and, it seems to me, that you can't use the normal DragEvents. Fine, I'll switch to using NativeDragEvents. However, neither drag event object does fully what the other one does. For instance, NativeDragEvent doesn't have a "dragInitiator" property and DragEvent of course doesn't have a "clipboard" property (thus I cant access the files).

      No problem I say to myself, i'll just create two sets of events which in fact keeps things a bit cleaner as they are two different process BUT... regardless of what you do drag an existing icon on the file tree or a new file into the file tree BOTH DragEvent and NativeDragEvents always fire. This means that for each event handler I have to add extra code in each to determine whether I want that event handler to process.

      Does this sound familiar to anyone else? Am I making this more complicated than I need to in order to be able to support dragging around "icons" that are in the air app already as well as new files onto the air from the desktop?

      I would have guessed (and in fact did) that if you dragged a file then ONLY the event listener bound to NativeDragEvent.NATIVE_DRAG_ENTER would fire and likewise dragging an existing element in the AIR app (i.e. icons) would file ONLY the DragEvent.DRAG_ENTER event. But both seem to fire always.

      Zach Brown