Groups | Blog | Home
all groups > flash actionscript > march 2004 >

flash actionscript : Preloader


Oceanrock
3/6/2004 7:40:06 PM
Is it possible to reuse a preloader and if so, how would you get the
information for one movie level to the next to control the bar movement.

I can control the movie and send data to multiple levels, but I can not
control the tween for the bar movement. I have three levels: main movie
(_root), content (_root.content) and loader (_root.content.loader).

If someone knows how or has a script I can use, that would be great.

Thanks

kglad
3/6/2004 9:02:50 PM
sure, you can reuse a preloader. here's an example that would preload anything
loaded into a _level or movieclip:

preloadF(mc){
pctLoaded=Math.floor(100*mc.getBytesLoaded()/mc.getBytesTotal());
loadBar._xscale=pctLoaded;
yourTextField.text=pctLoaded+"% loaded";
if(pctLoaded>99){
clearInterval(preloadI);
//do whatever, you're movie is loaded
}

and call this function using a setInterval and pass the target movieclip or
_level as a parameter. for example:

loadMovieNum("myswf.swf",22);
preloadI=setInterval(preloadF,400,_level22);
AddThis Social Bookmark Button