Press control key as drag and drop : Drag Drop « Development « Flex






Press control key as drag and drop

Press control key as drag and drop
          

<?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.Setting the dragMoveEnabled property to move instead of copySetting the dragMoveEnabled property to move instead of copy
2.Dragging and dropping within a component, to allow orderingDragging and dropping within a component, to allow ordering
3.Create DragSource object and add data to itCreate DragSource object and add data to it
4.Performing a two-way drag and dropPerforming a two-way drag and drop
5.Dragging and dropping in the same controlDragging and dropping in the same control
6.The drag initiators, and drop targetThe drag initiators, and drop target
7.Get Drag source data formatGet Drag source data format
8.Canvas Drag and DropCanvas Drag and Drop
9.Specifying the drag indicator by using the DragSpecifying the drag indicator by using the Drag
10.Specify a Drag ProxySpecify a Drag Proxy
11.Enable and Disable Drag OperationsEnable and Disable Drag Operations
12.Drag Drop To ComponentDrag Drop To Component
13.Set liveDragging to true to dispatch change event continuously as moving the thumbSet liveDragging to true to dispatch change event continuously as moving the thumb
14.Get drag source from DragEventGet drag source from DragEvent
15.Canvas drag enter eventCanvas drag enter event
16.Explpicitly handle the dragOver eventExplpicitly handle the dragOver event