How do I make the loader reach 100% when all a.swf, b.swfs, c.wfs and d.swf completes loading?
prototypeLDR.addListener(prototypeLO);
var swfsLoaded:Number=0;
var prototypeLDR:MovieClipLoader = new MovieClipLoader();
var prototypeLO:Object = {}; prototypeLDR.addListener(prototypeLO);
prototypeLO.onLoadInit = function(targetMC2:MovieClip){
swfsLoaded++;
if(swfsLoaded==4){
for (i=1; i<5; i++) {
_root.vest_mc["mcA"+i+"_mc"]._visible=false;
}
_root.loaderBar2._visible = false;
_root.borderX2._visible = false;
_root.loaderBack2._visible = false;
_root.gotoAndPlay(9);
}
}
prototypeLO.onLoadStart = function(targetMC2) {
_root.loaderBar2._visible = true;
_root.borderX2._visible = true;
_root.loaderBack2._visible = true;
};
prototypeLO.onLoadProgress = function(targetMC2, lBytes, tBytes) {
_root.loaderBar2._width = (lBytes/tBytes)*100;
_root.percentDisplayZ.text = "% "+Math.round((lBytes/tBytes)*100);
};
btn.onRelease = function() {
prototypeLDR.loadClip("www.web.com/myfile/a.swf,_root.main1_mc);
prototypeLDR.loadClip("www.web.com/myfile/b.swf,_root.main2_mc);
prototypeLDR.loadClip("www.web.com/myfile/c.swf,_root.main3_mc);
prototypeLDR.loadClip("www.web.com/myfile/d.swf,_root.main4_mc);
//do more...
}
You need a variable that is the sum of the total bytes of all your SWF and one that has the count of bytes loaded for use in instead of lBytes and Tbytes
Thanks. How do I get the total count?
One approach would be to make the bar width total change 25% for each file.
Thanks Ned. But the bar would still be _visible=false; 4 times?
bytes_loaded=Math.round(loaderA.getBytesLoaded()+loaderB.getBytesLoade d()+loaderC.getBytesLoaded()+loaderD.getBytesLoaded());
bytes_total=Math.round(loaderA.getBytesTotal()+loaderB.getBytesTotal() +loaderC.getBytesTotal()+loaderD.getBytesTotal());
Thanks.
loaderA, loaderB, etc... do I have to define those or something?
You can add a counter
var counter:int=0;
prototypeLO.onLoadProgress = function(targetMC2, lBytes, tBytes) {
_root.loaderBar2._width = (lBytes/tBytes)*100;
_root.percentDisplayZ.text = "% "+Math.round((lBytes/tBytes)*100);
if(++counter>=4){
_root.loaderBar2._visible = false;
_root.borderX2._visible = false;
_root.loaderBack2._visible = false;
}
};
Yep! that is nice.
but what about the _root.loaderBar2? How can I make this look progressing?
Not working:
var bytes_loaded=Math.round(_root.main1_mc.getBytesLoaded()+_root.main2_mc.getBytesLoaded()+_root.main3_mc.getBytesLoaded()+_root.main4_mc.getBytesLoaded());
var bytes_total=Math.round(_root.main1_mc.getBytesTotal()+_root.main2_mc.getBytesTotal() +_root.main3_mc.getBytesTotal()+_root.main4_mc.getBytesTotal());
prototypeLO.onLoadProgress = function(targetMC2, lBytes, tBytes) {
_root.loaderBar2._width = (bytes_loaded/bytes_total)*100;
North America
Europe, Middle East and Africa
Asia Pacific