You bet! There are quite a few 'short hand' methods to do things... but you'll want to be careful with how you use contructors/object casting inside calls. If BitmapData were somehow to end up null. subsequent operations on a null object leads to runtime errors. In this case BitmapAsset can take null as an argument but will still return an 'empty' bitmap - so no big. Also - while 'short hand' approaches appear 'smaller' the statements true meaning (number of operations) will always be interpreted by the compiler and VM and not by how many constructors you can nest in a single line. Here the real savings is in minimizing object overhead. Image is derived from SWFLoader and BitmapAsset is derived from Bitmap. BitmapAsset is 'slimmer.'
Rick Winscot From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Harald Dehn Sent: Saturday, April 12, 2008 9:38 AM To: flexcoders@yahoogroups.com Subject: AW: [flexcoders] drag and drop a button? Hi Winscot, I found an alternative way to get a proxy image for the DragManager // FANCY: // --- // Add a proxy image here for drag manager to use if you would like! var proxy:UIComponent = UIComponent( event.currentTarget ); // Copy the contents of the control (a la bitmap data) var bitmapData:BitmapData = new BitmapData( proxy.width, proxy.height ); bitmapData.draw( proxy ); // Let the drag manager take care of the rest - with a visual indicator of what its dragging... DragManager.doDrag( dragChild, dragSource, event, new BitmapAsset(bitmapData) ); Harald Von: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von Rick Winscot Gesendet: Samstag, 12. April 2008 03:05 An: flexcoders@yahoogroups.com Betreff: RE: [flexcoders] drag and drop a button? Take a look at this sample - BitmapData is used to create a proxy on the fly of the object being dragged. http://www.quilix.com/node/3 Rick Winscot From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of grimmwerks Sent: Friday, April 11, 2008 10:23 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] drag and drop a button? Is there a simple tutorial for it? I don't really want to have an image proxy - I want to really drag a button somwhere else on the canvas. Simple.
<<image001.jpg>>
<<image002.jpg>>