开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜