Use DragManager Class and define your own format : DragManager « Development « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Development » DragManagerScreenshots 
Use DragManager Class and define your own format
Use DragManager Class and define your own format
        


<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal">

    <mx:Script>
        
            import mx.core.DragSource;
            import mx.core.IUIComponent;
            import mx.events.DragEvent;
            import mx.managers.DragManager;

            private function mouseDownHandlerevt:MouseEvent ):void
            {
                var initiator:IUIComponent = evt.currentTarget as IUIComponent;
                var dragSource:DragSource = new DragSource();
                dragSource.addDatainitiator, "box");
                DragManager.doDraginitiator, dragSource, evt );
            }
            private function dragEnterHandlerevt:DragEvent ):void
            {
                ifevt.dragSource.hasFormat"box") )
                {
                    DragManager.acceptDragDropCanvasevt.currentTarget ) );
                }
            }
            private function dropHandlerevt:DragEvent ):void
            {
                var box:Box = Boxevt.dragInitiator );
                box.x = evt.localX;
                box.y = evt.localY;
            }

      
    </mx:Script>
    <mx:Canvas id="canvas" backgroundColor="0x0000FF" width="300" height="300" dragEnter="dragEnterHandler(event);" dragDrop="dropHandler(event);">
        <mx:Box id="dragItem" width="100" height="100" backgroundColor="0x00FF00" mouseDown="mouseDownHandler(event);"/>
    </mx:Canvas>

</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.DragManager.showFeedback(DragManager.MOVE);DragManager.showFeedback(DragManager.MOVE);
6.Do the drag with DragManagerDo the drag with DragManager
7.DragManager.acceptDragDropDragManager.acceptDragDrop
8.Canvas drag and drop by using DragManager
9.Style for DragManagerStyle for DragManager
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.