Enable and Disable Drag Operations
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" creationComplete="creationHandler();">
<mx:Script>
import mx.events.DragEvent;
import mx.collections.ArrayCollection;
[Bindable]
public var isEnabled:Boolean = true;
private function creationHandler():void {
list1.dataProvider = new ArrayCollection(['A', 'B', 'C']);
list2.dataProvider = new ArrayCollection(['D', 'E', 'F']);
}
private function dragEnterHandler( evt:DragEvent ):void {
evt.target.dropEnabled = ( evt.target != evt.dragInitiator );
}
</mx:Script>
<mx:VBox width="100%" height="100%">
<mx:List id="list1" width="200" height="200" dragEnabled="{isEnabled}" dragMoveEnabled="true"
dragEnter="dragEnterHandler(event);"/>
<mx:List id="list2" width="200" height="200" dragEnabled="{isEnabled}"
dragMoveEnabled="true" dragEnter="dragEnterHandler(event);"/>
</mx:VBox>
</mx:Application>
Related examples in the same category