开发者

How do I Convert an FXG image to Bitmapdata of fixed size

开发者 https://www.devze.com 2023-04-12 12:08 出处:网络
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:

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号