0 Replies Latest reply on May 3, 2007 8:58 AM by jdoklovic

    dragDrop COPY Bug (with fix)

    jdoklovic
      If you read the quick start on drag/drop: http://www.adobe.com/devnet/flex/quickstart/adding_drag_and_drop/
      it states:
      quote:

      Copying items by using the drag-and-drop operation
      The following example lets you copy items from one List control to another by dragging them. You can copy the same item multiple times from the drag initiator to the drop target.

      However, even in the sample movie, this does not work... if you copy the same item multiple times, it does not truly do a copy and just adds a reference to the same object, thus you can only ever rollover/select one of the instances and the others cannot be interacted with.

      To correct this, the following code should be replaced on line 7277 of mx.controls.listClasses.ListBase:

      original:
      for (i = items.length - 1; i >= 0; i--)
      {
      collectionIterator.insert(items );
      }

      fixed:
      for (i = items.length - 1; i >= 0; i--)
      {
      if(event.action == DragManager.COPY)
      {
      var clone:ByteArray = new ByteArray();
      clone.writeObject(items
      );
      clone.position = 0;
      collectionIterator.insert(clone.readObject());
      }
      else
      {
      collectionIterator.insert(items );
      }
      }

      Hopefully Adobe can fix this in the core SDK

      - Jonathan