Creating a custom drag image : Image Drag Drop « Graphics « 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 » Graphics » Image Drag DropScreenshots 
Creating a custom drag image
Creating a custom drag image
           
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        import mx.managers.DragManager;
        import mx.core.DragSource;
        
        import flash.events.MouseEvent;
        import mx.controls.Image;
        public var imgCopy:Class;
        [Embed(source='a.png')]
        public var imgDrag:Class;
        
        public function initiateDrag(event:MouseEvent):void
        {
            var dragInitiator:Button=Button(event.currentTarget);
            var ds:DragSource = new DragSource();
            var dragImage:Image = new Image();
            var xOffset:int = -2;
            var yOffset:int = -2;
            var alphaLevel:Number = 0.5;
            dragImage.source = imgDrag;
            dragImage.height=100;
            dragImage.width=100;
            DragManager.doDrag(dragInitiator, ds, event,
            dragImage,xOffset,yOffset,alphaLevel);
        }
      
    </mx:Script>
    <mx:Button label="OK" mouseMove="initiateDrag(event)" />
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  
Related examples in the same category
1.Drag and drop image on Canvas with ghost imageDrag and drop image on Canvas with ghost image
2.Drag and drop image on CanvasDrag and drop image on Canvas
3.Drag to copy image between two Canvas controlsDrag to copy image between two Canvas controls
4.Drag and move an Image from one Canvas to another CanvasDrag and move an Image from one Canvas to another Canvas
5.Use Image control to load a draggable image into a Canvas container.Use Image control to load a draggable image into a Canvas container.
6.Drag and Drop Image, Copy MoveDrag and Drop Image, Copy Move
ww_w_.j_a__v___a__2_s___.c__o___m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.