     
     /**
      *  Handles <code>DragEvent.DRAG_COMPLETE</code> events.  This method
-     *  removes the item from the data provider.
+     *  removes the items from the data provider.
      *
      *  @param event The DragEvent object.
      *  

     *  @playerversion AIR 1.5
     *  @productversion Flex 4
     */
    protected function addDragData(dragSource:DragSource):void
    {
        dragSource.addHandler(copySelectedItemsForDragDrop, "sourceOrderedItems");
        
        // Calculate the index of the focus item within the vector
        // of ordered items returned for the "sourceOrderedItems" format.
        var focusIndex:int = 0;
        var draggedIndices:Vector.<int> = selectedIndices;
        var count:int = draggedIndices.length;
        for (var i:int = 0; i < count; i++)
        {
            if (mouseDownIndex > draggedIndices[i])
                focusIndex++;
        }
        dragSource.addData(focusIndex, "sourceOrderedItemsFocus");
    }
    
    /**
     *  @private.
     */
    private function copySelectedItemsForDragDrop():Array
    {
        var result:Array = [];
        var draggedIndices:Vector.<int> = selectedIndices;
        // Copy the vector so that we don't modify the original as 
        // selectedIndices returns a reference.
        draggedIndices = draggedIndices.slice(0, draggedIndices.length);
        if (draggedIndices)
        {
            draggedIndices.sort(compareValues);
            var count:int = draggedIndices.length;
            for (var i:int = 0; i < count; i++)
                result.push(dataProvider.getItemAt(draggedIndices[i]));  
        }
        return result;
    }
    

import mx.core.EventPriority;
import mx.core.IFlexDisplayObject;
import mx.core.IVisualElement;
import mx.core.mx_internal;
import mx.events.DragEvent;
import mx.events.SandboxMouseEvent;
import mx.managers.DragManager;
