I need to do this conversion so that I can determin the drag drop colour a puck lands on.
Anybody have any ideas, possibly involving:
ImageSnap开发者_如何学Goshot BitmapData
This would be in Flex 4
Once the component is rendered on the screen; you can get BitMapData using something like this:
static private function getUIComponentBitmapData( target : UIComponent ) : BitmapData
{
var bd : BitmapData = new BitmapData( target.width, target.height,true);
var m : Matrix = new Matrix();
bd.draw( target, m );
return bd;
}
[Note: I borrowed this method from a blog somewhere; but the URL I had on file for it is returning a 404]
Then you can turn that bitMapData into an image for display:
var bitMap:Bitmap = new Bitmap(bitMapData);
var image : Image = new Image();
image.source = bitMap;
精彩评论