PDA

View Full Version : Grabbing the size of a dynamically loaded image?


EdwardW
06-27-2008, 08:29 PM
Hi

probably a simple thing, but I have a movieclip with various layers in it, and I'm duplicating this clip according to an XML document. If the XML indicates an image, I'm grabbing that image from a directory on the server and loading it into the movie clip.

Problem is, the images are all different sizes, so I'm guessing what I need to do is to target the loader box within that movie clip and resize it according to how big the image I've just loaded is.

But as far as I can see, the size of the image loaded is only ever as big as the loader I've put on the stage inside of this movie clip. So its a bit catch 22.

So the question is how do you make the loader scale to fit the image rather than the other way around? I thought about putting the image size in the XML itself, but thought that was cheating a bit. I'm sure theres a better way.

I've had a look through the forum but could only find things for AS2 not AS3. Any help would be appreciated.

Thanks in advance

Edward.

EdwardW
06-27-2008, 11:06 PM
Scratch that, I just found the "scaleContent" parameter :)