List dragOver, dragDrop, dragExit events : List Event « Components « Flex






List dragOver, dragDrop, dragExit events

List dragOver, dragDrop, dragExit events
           

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp();">
    <mx:Script>
    
    import mx.managers.DragManager;
    import mx.events.DragEvent;
    import mx.collections.ArrayCollection;
    private function initApp():void {
    firstList.dataProvider = new ArrayCollection([
            {label:"First", data:"1"},
            {label:"Second", data:"2"},
            {label:"Third", data:"3"},
            {label:"Fourth", data:"4"}
        ]);
        secondList.dataProvider = new ArrayCollection([]);
    }
    private function dragOverHandler(event:DragEvent):void {
        event.preventDefault();
        event.currentTarget.showDropFeedback(event);
        if (event.dragSource.hasFormat("items")){
            if (event.ctrlKey) {
                DragManager.showFeedback(DragManager.COPY);
                return;
            }
        }
        DragManager.showFeedback(DragManager.NONE);
    }
    private function dragDropHandler(event:DragEvent):void {
        dragExitHandler(event);
    }
    private function dragExitHandler(event:DragEvent):void {
       

    }
  
    </mx:Script>
    <mx:HBox id="myHB">
    <mx:List id="firstList" dragEnabled="true"/>
    <mx:List id="secondList"
        dropEnabled="true"
        dragMoveEnabled="true"
        dragOver="dragOverHandler(event);"
        dragDrop="dragExitHandler(event);"
        dragExit="dragExitHandler(event);"/>
    </mx:HBox>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Change event for List controlChange event for List control
2.Adding an event listener if one isn't presentAdding an event listener if one isn't present
3.Event listener in an ActionScript function in an tagEvent listener in an ActionScript function in an <mx:Script> tag
4.List change eventList change event
5.Get selected item from a list from change eventGet selected item from a list from change event
6.Convert event target to List controlConvert event target to List control
7.Write your event listener to access the event objectWrite your event listener to access the event object
8.A data-binding watcher invokes an event listener when a binding occurs.A data-binding watcher invokes an event listener when a binding occurs.
9.List double click eventList double click event
10.Add an Event Listener in MXMLAdd an Event Listener in MXML