MX question

I am attempting to make an All Flash website that uses one SWF as the main page, with each subsection dynamically loaded via the loadMovie command. I would like each subsection to have a preloader for itself, but the problem i encounter is that the dynamically loaded SWF’s use _root in the preloader, and therefore do not work when loaded into the main movie.

My question is, how can i change the code so that the preloader works for each SWF that its in, even though those are dynamically loaded?

here’s the code as taken from Kirupa.com’s Preloader with Percentage Tutorial:


bytes_loaded = Math.round(_root.getBytesLoaded());
bytes_total = Math.round(_root.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
_root.loadBar._width = getPercent*100;
_root.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded == bytes_total) {
    _root.gotoAndPlay(3);
}

Any help would be appreciated… :crazy:

have you tried [color=red]_parent[/color] ?? :crazy:

actually no i have not. I tried _self, which would make more sense, but it did not work. _parent would get the date from the first movie, which is the same as what _root does, and therefore does not seem to be what i need. But i will try it nonetheless…

what about [color=red]_root.yourHolderInstanceName.getBytesLoaded()[/color] ??

that might be more along the lines of what i need. Let me give it a go…

Beautiful! using _root.WHATEVER THE NAME OF THE CLIP IS.getBytesLoaded()… works! All i have to do is change the code to point to the movie thats loaded and it works. Thanks a lot for the tip, Kax…

anytime man :wink:

glad it worked :smirk: