Groups | Blog | Home
all groups > flash actionscript > january 2007 >

flash actionscript : loadMovie to load a picture



oscmejia
1/28/2007 11:54:47 PM
Hi,

I;m using this code:


this.createEmptyMovieClip("image_mc", 9);
image_mc.loadMovie("http://www.helpexamples.com/flash/images/image1.jpg");

trace("Height: " + image_mc._height);


I need to center the image i'm loading but i cant get the size. after trace i
got:

Height:: 0

If I use loadMovie with a non-empty movie clip i got the original MC size.

any ideas?

Thanks in advance
kglad
1/29/2007 12:59:44 AM
you must wait until loading is complete before you can accurately access the
images _width and _height properties. ie, use preloader code or the
onLoadInit() method of the moviecliploader class' listener.
oscmejia
1/29/2007 4:05:56 AM
absolutly right.

kglad
1/29/2007 4:35:21 AM
AddThis Social Bookmark Button