DragManager.showFeedback(DragManager.MOVE); : DragManager « Development « Flex






DragManager.showFeedback(DragManager.MOVE);

DragManager.showFeedback(DragManager.MOVE);
        
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    backgroundColor="white">
    <mx:Script>
        
        import mx.core.DragSource;
        import mx.managers.DragManager;
        import mx.events.*;
        import mx.controls.Button;
        import mx.collections.ArrayCollection;

        [Bindable]
        public var myAC:ArrayCollection = new ArrayCollection([
            {name:"A", price:1.5},
            {name:"B", price:1.8}]);
        
        public function initiateDrag(event:MouseEvent):void
        {
            var dragInitiator:Button = Button(event.currentTarget);
            var ds:DragSource = new DragSource();
            ds.addData(dragInitiator.label,"name");
            DragManager.doDrag(dragInitiator, ds, event);
        }
        public function handleDragEnter(event:DragEvent):void
        {
            DragManager.acceptDragDrop(event.currentTarget as VBox);
        }
        public function handleDragOver(event:DragEvent):void
        {
            DragManager.showFeedback(DragManager.MOVE);
            event.currentTarget.setStyle('borderColor', 'yellow');
        }
        public function handleDrop(event:DragEvent):void
        {
            var newButton:Button = new Button();
            newButton.label = event.dragSource.dataForFormat("name") as String;
            droppableArea.addChild(newButton);
            droppableArea.setStyle('borderColor','black');
            if(event.action == DragManager.MOVE)
                buttonPanel.removeChild(event.dragInitiator as Button);
        }
        public function handleDragExit(event:DragEvent):void
        {
            droppableArea.setStyle('borderColor','black');
        }
      
    </mx:Script>
    <mx:VBox id="buttonPanel">
        <mx:Label text="Drag the buttons into the box to copy them in" />
        <mx:Button label="A" mouseMove="initiateDrag(event)" />
    </mx:VBox>
    <mx:VBox id="droppableArea" 
             borderColor="black" 
             dragEnter="handleDragEnter(event)" 
             dragOver="handleDragOver(event)"
             dragDrop="handleDrop(event)" 
             dragExit="handleDragExit(event)"
             width="94" 
             height="76" 
             backgroundColor="#D7FE2E" 
             borderStyle="solid" />
</mx:Application>

   
    
    
    
    
    
    
    
  








Related examples in the same category

1.Use DragManager.acceptDragDrop to accept drop targetUse DragManager.acceptDragDrop to accept drop target
2.Use DragManager.showFeedback to show user feed back when drag and drop
3.DragManager.showFeedback(DragManager.LINK);DragManager.showFeedback(DragManager.LINK);
4.DragManager.showFeedback(DragManager.COPY);DragManager.showFeedback(DragManager.COPY);
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