Use DragManager.acceptDragDrop to accept drop target : DragManager « Development « Flex






Use DragManager.acceptDragDrop to accept drop target

Use DragManager.acceptDragDrop to accept drop target
        

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        import mx.collections.ArrayCollection;
        import mx.events.DragEvent;
        import mx.managers.DragManager;
        [Bindable]
        public var myAC:ArrayCollection = new ArrayCollection([
            {name:"A", email:"a@domain.com"},
            {name:"B", email:"b@domain.com"},
            {name:"C", email:"c@domain.com"}]);
            
        public function handleDragEnter(event:DragEvent):void
        {
            var arItems:Array= event.dragSource.dataForFormat("items") as Array;
            
            for (var i:int = 0; i < arItems.length; i++)
                DragManager.acceptDragDrop(dgTarget);
        }
      
    </mx:Script>
    <mx:DataGrid id="dgSource" dataProvider="{myAC}" dragEnabled="true"
        dragMoveEnabled="true">
        <mx:columns>
            <mx:DataGridColumn dataField="name" headerText="Contact Name" width="300" />
            <mx:DataGridColumn dataField="email" headerText="E-Mail" width="200" />
        </mx:columns>
    </mx:DataGrid>
    <mx:DataGrid id="dgTarget" dropEnabled="true" dragEnter="handleDragEnter(event)">
        <mx:columns>
            <mx:DataGridColumn dataField="name" headerText="Contact Name" width="300" />
            <mx:DataGridColumn dataField="email" headerText="E-Mail" width="200" />
        </mx:columns>
    </mx:DataGrid>
</mx:Application>

   
    
    
    
    
    
    
    
  








Related examples in the same category

1.Use DragManager.showFeedback to show user feed back when drag and drop
2.DragManager.showFeedback(DragManager.LINK);DragManager.showFeedback(DragManager.LINK);
3.DragManager.showFeedback(DragManager.COPY);DragManager.showFeedback(DragManager.COPY);
4.DragManager.showFeedback(DragManager.MOVE);DragManager.showFeedback(DragManager.MOVE);
5.Do the drag with DragManagerDo the drag with DragManager
6.DragManager.acceptDragDropDragManager.acceptDragDrop
7.Use DragManager Class and define your own formatUse DragManager Class and define your own format
8.Canvas drag and drop by using DragManager
9.Style for DragManagerStyle for DragManager