Let current event target show the drop feedback : Event Target « Event « Flex






Let current event target show the drop feedback

Let current event target show the drop feedback
           

<?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.Get current target from eventGet current target from event
2.Pass current event target text to functionPass current event target text to function
3.Get event target labelGet event target label
4.Display current phase and information about the current targetDisplay current phase and information about the current target
5.Display the current phase and current target's IDDisplay the current phase and current target's ID
6.Use the target property not currentTarget propertyUse the target property not currentTarget property
7.Event target idEvent target id
8.Use Event object to access methods and properties of the target component, or the component that dispatched the event.Use Event object to access methods and properties of the target component, or the component that dispatched the event.
9.Check event current target class nameCheck event current target class name
10.Get event type, event target and event target idGet event type, event target and event target id
11.Check event target id