开发者

Flex: How to get the image size of an Image?

开发者 https://www.devze.com 2022-12-25 22:16 出处:网络
Give an Image component, how can I tell the size [width and height] of the bitmap image that the Image is containing (no开发者_如何学运维t the size of the Image component)

Give an Image component, how can I tell the size [width and height] of the bitmap image that the Image is containing (no开发者_如何学运维t the size of the Image component)

Also I want to know this as soon as possible, so I think this needs to be in the Event.COMPLETE event?

Thanks!!


Since Image extends SWFLoader, properties contentWidth and contentHeight are both publicly available. They are available on the "complete" event.

Accessing the Image's bitmap data might not be allowed if the Image is loaded from another domain.


The BitmapData class will give you the width and height properties.

This should be available in the

protected measure()

method, which you can override if you need to do things to it.

0

精彩评论

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