http://www.axelscript.com/2008/03/26/creating-a-dragimage-from-your-uicomponent/
 

 

This is a blog post a friend of mine wrote about this.  Specifically you want 
this method:

 

public function getUIComponentBitmapData( target : UIComponent ) : BitmapData

            { 

                var bd:BitmapData = new BitmapData( target.width, target.height 
);

                var m:Matrix = new Matrix();

                bd.draw( target, m );

                return bd;  

            }

 

This gets bitmap data for whatever UIComponent you may be using for the 
renderer.  Then, here’s his function to initiate dragging:

 

private function doDrag(e:MouseEvent):void

            {

                //create an aliase for easier coding for the uicomponent

                var target:UIComponent = e.currentTarget as UIComponent;

                

                //http://www.actionscript.org/forums/showthread.php3?t=152558

                var lvImageClone:Image = new Image();

                lvImageClone.source = new 
Bitmap(getUIComponentBitmapData(target));

                

                var lvDragSource:DragSource = new DragSource();

                lvDragSource.addData( target, "items" );               

                

                // Call the DragManager doDrag() method to start the drag. 

                DragManager.doDrag(target, lvDragSource, e, lvImageClone, 0, 0, 
dragImageAlpha);

            }

 

What is important here is the last line.  DragManager.doDrag takes the alpha as 
a parameter so you can have a fully transparent background.  You’ll have to add 
the border yourself.

 

Jake Churchill
CF Webtools
11204 Davenport, Ste. 100
Omaha, NE  68154
 <http://www.cfwebtools.com> http://www.cfwebtools.com
402-408-3733 x103

From: [email protected] [mailto:[email protected]] On Behalf 
Of thomas parquier
Sent: Monday, May 25, 2009 5:18 PM
To: [email protected]
Subject: [flexcoders] dnd list items

 






Hi,

I'm using a list and custom items can be dnd'd. But the proxy has a white 
background with a grey border (which the itemrenderer doesnt have), and the 
whole proxy is a bit transparent. How to get a completely transparent 
background and no border ?

thomas
---
http://www.web-attitude.fr/
msn : [email protected]
softphone : sip:[email protected] <mailto:sip%[email protected]> 
téléphone portable : +33601 822 056



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.339 / Virus Database: 270.12.39/2133 - Release Date: 05/25/09 
08:16:00

Reply via email to