Link to home
Start Free TrialLog in
Avatar of jrm213jrm213
jrm213jrm213Flag for United States of America

asked on

Getting the height of a dynamically loaded movie

I have a flash movie that loads images from an xml document into a movie clip. I am placing the images at a specified interval but I want their to be able to have different sized images with the same spacing between them.
I was going to do this by dynamically figuring out (starting at 0) where to place the next clip with something like:

var interval = 20;
var currentheight = 0;
for (i=0;i<n;i++)
{
   var currentThumb_mc = scroller.createEmptyMovieClip("thumbnail_mc"+i,i);
   currentThumb_mc._y = currentheight;
   currentThumb_mc.createEmptyMovieClip("thumb_container",0);
   currentThumb_mc.thumb_container.loadMovie(currentPicture.attributes.thumb);

   currentheight = currentheight + currentThumb_mc._height + interval;
}


However currentThumb_mc._height is always zero. After loading the image in the movie should have a size shouldn't it?

So I guess what I am looking for is how to get the height of a loaded movie.

Thanks!

   
}
ASKER CERTIFIED SOLUTION
Avatar of rascalpants
rascalpants
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jrm213jrm213

ASKER

Ok,

This is my first time ever using Flash and I kind of figured that was the case but was hoping that it wasn't. I am guessing that there is no guarantee that the movie will load before my code starts loading the next one and I need the height increase before that to determine where to place the next clip.

I ended up placing the height into the xml. It is another step in the process and prone to human error but it is what it is I guess.

Thanks for the info and the link to the article.

actually because of latency, you will almost never have the value of the ready to be used when you use loadMovie, even when the files are on your local desktop.

let me know if you need help with the MovieClipLoader class.


rp