Preloading External SWFs
Preloading External SWFs
by lexthayn
on
Mar 9, 2007 at 6:43:15 pm
alright. i have looked on a few forums. and tutorials. and haven't really come up with a portable and easily understandable way to do this:
I have a portable preloader (with load bar & percentage) and it uses this script:
Code:
myInterval = setInterval (preloader,100);
function preloader () {
myLoaded = Math.round(_root.getBytesLoaded());
myTotal = Math.round(_root.getBytesTotal());
myPercent = myLoaded/myTotal; myBar._width = myPercent*150;
myText = Math.round(myPercent*100)+"%";
if (myLoaded == myTotal) {
_root.gotoAndStop(2);
clearInterval (myInterval);
}
}
this works great.
i want to use this same preloader to preload external swf's.
this is the code i have for loading the external swf
Code:
one.onRelease = function () {
page.loadMovie("biospage.swf");
}
i have 9 buttons that load different swf's with the loadMovie code.
so my idea was to attach a duplicate version (with altered script) of the preloader mentioned above to an empty movie clip upon release of the button
so these are my 2 questions:
can i target the external swf that is being loaded?
how can i alter my preloader script to preload the external swf?
Thanks,
Lex
Re: Preloading External SWFs by rene hazekamp on Mar 10, 2007 at 10:41:36 am
To make this work, you need to use the MovieClipLoaderClass.
It's pretty well explained in the help section of flash 8,
in older versions the help section is less helpful.
rene hazekamp
http://www.renehazekamp.com