Getting image size in ActionScript
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.
精彩评论