Wind Chimez
Wind Chimez

Reputation: 1176

Getting image size in ActionScript

Can I get the height 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.

Upvotes: 2

Views: 561

Answers (2)

NH884
NH884

Reputation: 74

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

Upvotes: 1

Amarghosh
Amarghosh

Reputation: 59471

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.

Upvotes: 2

Related Questions