开发者

Get width and height of embed image in Flex?

开发者 https://www.devze.com 2023-03-12 07:42 出处:网络
I have the follow declaration : [Embed(source=\"i/6.png\")] private var img6 : Class; How开发者_如何学Go can i determine \"img6\" width and height ?

I have the follow declaration :

[Embed(source="i/6.png")]
private var img6 : Class;


You can determine size of embed image only on instantiation. Something like:

<s:BitmapImage source="{img6}" complete="completeHandler(event)" />
…
private function completeHandler(event:Event):void
{
    var image:BitmapImage = BitmapImage(event.currentTarget);
    trace (image.sourceWidth);
    trace (image.sourceHeight);
}
0

精彩评论

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

关注公众号