开发者

Getting image size in ActionScript

开发者 https://www.devze.com 2023-01-03 18:08 出处:网络
Can I get the hei开发者_JAVA技巧ght of an image from its URL information in ActionScript 3? I have the image URL. I want to draw the image in my UI and I want to set the height of the drawing area d

Can I get the hei开发者_JAVA技巧ght of an image from its URL information in ActionScript 3?

I have the image URL. I want to draw the image in my UI and I want to set the height of the drawing area dynamically upon getting the image.


You can read the height/width of an image only after loading it to your SWF. Load the image using a Loader instance, cast the loader.content to Image, read the height and width of its bitmapData.


You can use the loader class. Once the image is loaded in the object, use loaderInfo for getting the image properties.

0

精彩评论

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