0 Replies Latest reply on Jan 28, 2011 7:02 AM by embinder

    List DragDrop


      I have an AIR app with a list. I want to be able to drag items from  the list to the desktop but also would like to maintain the ability to  dragMove the items in the list. The native dragStart for a list will  allow the dragMove which is great, but when I add my own code in a  DRAG_START listener for copying the file to the computer it loses that  functionality.



      What I thought made the most sense was to actually have my code for  copying the files in a DRAG_EXIT listener, though that doesn't seem to  be the answer. Even though the function is called the new  NativeDragManager.doDrag() does not seem to work.


                  private function onDragStart(e:DragEvent):void
      var volumes:Vector.<StorageVolume> = StorageVolumeInfo.storageVolumeInfo.getStorageVolumes();
      var driveFound:Boolean;
      var flashDrive:StorageVolume;

      for each (var vol:StorageVolume in volumes)
      if (vol.name == Constants.FLASH_DRIVE_NAME)
      = true;
      = vol;

      if (driveFound)
      var drivePath:String = flashDrive.rootDirectory.nativePath;
      var drivePathLastChar:String = drivePath.charAt(drivePath.length - 1);
      if (drivePathLastChar != "/" || drivePathLastChar != "\\") drivePath = drivePath + "/";

      var transfer:Clipboard = new Clipboard();
      var files:Array = [];

      for each (var a:Object in favoritesList.selectedItems)
      var file:File = new File(drivePath + a.location + a.mattelId + "." + a.fileType);

      .setData(ClipboardFormats.FILE_LIST_FORMAT, files, false);

      var dragOptions:NativeDragOptions = new NativeDragOptions();
      .allowMove = true;
      .allowCopy = true;
      .allowLink = false;

      NativeDragManager.doDrag(this, transfer, null, null, dragOptions);
      Alert.show("Please insert your Flash Drive");


      The previous code is what I am using to copy the files to the system.  It works as it should, though I then lose the dragMove() functionality.  Any thoughts?