8 Replies Latest reply on Feb 5, 2009 4:24 AM by valnub

    NativeDragManager

    valnub
      Hello,

      I just wondered if there is a way using AIR to get the target's path on the native filesystem from a drag & drop operation (Like if you move a file out of your app right on the desktop using d&d).

      As far as I can see, the NativeDragManager does not offer any method or listener, so how can I solve this problem?

      To sum it up: I need the path where the user dropped his file to.
        • 1. Re: NativeDragManager
          valnub Level 1
          Noone knows? :-(
          Oh, come on... There must be a way to get the path of the drop target :-(
          • 2. Re: NativeDragManager
            Joe ... Ward Level 4
            No, unfortunately, there is no way to get this information.
            • 3. NativeDragManager
              valnub Level 1
              I need a solution for my following problem then :-(

              I want my user to be able to drag a file from the inside of my app and drop it right e.g. on his desktop (The file is not locally available. It needs to be downloaded first. FTP-Client style).
              My program should download the file from a webservice now and put it on the desktop.
              Now here comes the dilemma:

              The NativeDragManager needs the file in its clipboard-object BEFORE the actual d&d operation has finished (short version of the code):



              var clip:Clipboard = new Clipboard();
              var arr:Array = new Array;
              arr.push(dragFile); // dragFile is an instance of "File"
              clip.setData(ClipboardFormats.FILE_LIST_FORMAT, arr);
              NativeDragManager.doDrag(mouseEvent2.target as InteractiveObject, clip, bitmap, null, dragOptions);



              This means, I have 2 possible choices (as far as I can see it):

              1. I let the app download the file once the user fires a mouseDown-Event on the file he wants to download and put it into the clipboard object for the NativeDragManager. This is not a very elegant one, since the download needs to be finished before the user ends his d&d operation. Otherwise the dropped file may be corrupted.

              2. I let the user do his d&d operation and use a dummy-file for the NativeDragManager. When the d&d operation has finished, I start downloading the file to the place where the user dropped his file.

              I think the 2nd one is the better solution, but unless I can't get the target path, I don't know where to download the file to.

              Any ideas? :-(
              I am really stuck at this point.
              • 4. Re: NativeDragManager
                valnub Level 1
                Noone's got an idea here?
                I dun need any code examples, just a little hint into the right direction :(
                • 5. Re: NativeDragManager
                  Joe ... Ward Level 4
                  There's no way to do this.You'll have to rethink your design. Maybe have a download step that copies the files to a temp directory, then show those files in the air app so that they can be dragged to their final destination.
                  • 6. Re: NativeDragManager
                    valnub Level 1
                    Damn...
                    thanks for the info though
                    • 7. Re: NativeDragManager
                      anemitoff12 Level 1
                      This is getting to be absurd! My company has a lot riding on Adobe AIR having chosen it as our technology foundation over a year ago. It is truly astounding how many features seem to perfect only to be revealed as fatally flawed once you start working with them!
                      • 8. NativeDragManager
                        valnub Level 1
                        Yeah, I was very excited about AIR when I started developing apps with it but now after half a year, I am a bit dissappointed.
                        FLEX is a great development envoirenment though, beating Flash by miles, if it comes up to apps that run inside a webbrowser.

                        But there are WAY better platforms out there for "real" desktop applications than AIR