My main mc contains 2 empty mc’s in which i’m loading 2 seperate swf’s into using this fine queue tut. The preloader currently displays a loading bar and description for each swf as it loads… BUT, is there an easy way to modify the preloader bar/code so you only see a single bar/percentage for both loads?
See attached code below:
[COLOR=Blue] /////// code on main timeline////////
stop();
#include “Queue.as”
//first we put all the items in a queue ready to be loaded
aQueue.push({source: ‘images/man.jpg’, level: “mcContainer2”, text: ‘Loading Man Image’}); //this will load man.jpg in level 1
aQueue.push({source: ‘images/fire.jpg’, level: “mcContainer”, text: ‘Loading Fire Image’}); //this will load fire.jpg into movieclip mcContainer
//now we actually load everything in the queue
startQueue();
/// Linked Queue.as ///////////////
var count:Number = 0;
loadText_txt.autoSize = “left”;
preloader_mc.bar_mc._visible = false;
preloader_mc.bar_mc._xscale = 0;
var my_mcl:MovieClipLoader = new MovieClipLoader();
var loadListener:Object = new Object();
my_mcl.addListener(loadListener);
_global.aQueue = new Array();
_global.startQueue = function():Void {
preloader_mc.bar_mc._visible = true;
my_mcl.loadClip(aQueue[0].source, aQueue[0].level);
}
loadListener.onLoadStart = function() {
showLoader(true);
};
loadListener.onLoadProgress = function(loadTarget, loadedBytes, totalBytes) {
loadText_txt.text = aQueue[count].text;
preloader_mc.bar_mc._xscale = loadedBytes/totalBytes*100;
};
loadListener.onLoadInit = function() {
count++;
if (count<aQueue.length) {
my_mcl.loadClip(aQueue[count].source, aQueue[count].level);
}
if (count == aQueue.length) {
showLoader(false);
count = 0;
aQueue.length = 0; //everything has loaded so now empty array
_root.gotoAndStop("play");
}
};
function showLoader(visibility:Boolean):Void{
preloader_mc._visible = visibility;
loadText_txt._visible = visibility;
}[/COLOR]