[Webinar] Learn how to a build a cloud-first strategyRegister Now


Getting the height of a dynamically loaded movie

Posted on 2007-07-26
Medium Priority
Last Modified: 2013-11-12
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;

   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.


Question by:jrm213jrm213
  • 2
LVL 22

Accepted Solution

rascalpants earned 200 total points
ID: 19578357
you do not have access tothe movieclip properties until it is fully loaded...

so to I would use the MovieClipLoader class to set the values...  in the onLoadInit() method, is where you would use this line  currentheight = currentheight + currentThumb_mc._height + interval;

and here is a link to a nice tutorial about the movieclip loader class:


LVL 17

Author Comment

ID: 19581688

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.
LVL 22

Expert Comment

ID: 19582142

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.


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
Geo-targeting is the practice of distributing content based on a person’s location, as best as you can determine it. Let’s look at some ways you could successfully use this tactic. The following tips and case studies could lead to meaningful results.
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question