Preloader - lill prob

Hi

i have a bar preloader that i use. i am attaching the preloader on each menu item when the user first click on it. it loads all the content fine but when i click again on another menu item the preloader sti have a bar preloader that i use. i am attaching the preloader on each menu item when the user first click on it. it loads all the content fine but when i click again on another menu item the preloader start at 20%+ and shoots back to almost 0 and then start preloading. I use clear() to clear the empty MC where all the content is loaded and i even remove the preloader on each menu item after preloading to avoid any prob.I have tried everyhting and i cant get any other sol to make it start from 0 every time it loads the menu content. i thought about clearingthe cache but dont know how to do it?!!!

Anyone can provide me with any help.

Thanks art at 20%+ and shoots back to almost 0 and then start preloading. I use clear() to clear the empty MC where all the content is loaded and i even remove the preloader on each menu item after preloading to avoid any prob.I have tried everyhting and i cant get any other sol to make it start from 0 every time it loads the menu content. i thought about clearingthe cache but dont know how to do it?!!!

Anyone can provide me with any help.

Thanks

Jerome

you using loadClip() ? or loadMovie()

if it is too much to ask?

I am using loadClip().

daft question, but how is your MC in your loader set up?

you may have to set code, which tells it to be 0% until the file has loaded enough for it to know how much has loaded

post your loadClip() function code…

below is the code of the onLoadProgress and onLoadInit.
I am using one preloader which is attached to the menu item as soon as it starts preloading its swf.

use of attachMovieClip to attach preloader and use of loadClip to load swf.

thanks

loaderListener.onLoadProgress = function(holderClip:MovieClip, loadedBytes:Number, totalBytes:Number):Void {

if (Joe1Boolean == true) {
	var JoeNb:Number = 0;
	makePreloaderWork(JoeNb);
	disableMenu();
	
} else if (Joe2Boolean == true) {
	var JoeNb:Number = 1;
	makePreloaderWork(JoeNb);
	disableMenu();
			
} else if (Joe3Boolean == true) {
	var JoeNb:Number = 2;
	makePreloaderWork(JoeNb);
	disableMenu();
			
}else if (Joe4Boolean == true) {
	var JoeNb:Number = 3;
	makePreloaderWork(JoeNb);
	disableMenu();
		}

//function to make the preloader work… NEED IT HERE AND NOWHERE ELSE
function makePreloaderWork(i) {

	objectsInScene*.PreLoader_mc.onEnterFrame = function() {
		this._visible = true;//Make the preloader visible again

		if (percent == undefined) {
			percent = 0;
		}
		//------the line of code below is what makes the preloader being smooth      
		percent -= (percent-((loadedBytes/totalBytes)*100)) * 0.25;
		per = int(percent);
		this.percentTxt.text = per+"%";
		this.loadBar._width = per;

		if (percent > 99) {
			this._visible = false;
		}
	};
}

};

loaderListener.onLoadInit = function(holderClip:MovieClip):Void {

closeBtn.enabled = true;
closeBtn._visible = true;

if (Joe1Boolean == true) {
	var i:Number = 0;
	Tweener.addTween(objectsInScene*.base,{_xscale:Stage.width, _yscale:Stage.height, _alpha:100, time:1, transition:"easeOutQuad"});
	removeMovieClip(objectsInScene*.PreLoader_mc);		
	Movie2Loaded = Movie3Loaded = Movie4Loaded = false;
	Movie1Loaded = true;
	disableMenuBtn(); //function to disable the menu item if swf of this menu has already been loaded
			
} else if (Joe2Boolean == true) {
	var i:Number = 1;
	removeMovieClip(objectsInScene*.PreLoader_mc);
	Tweener.addTween(objectsInScene*.base,{_xscale:Stage.width, _yscale:Stage.height, _alpha:100, time:1, transition:"easeOutQuad"});
	Movie1Loaded = Movie3Loaded = Movie4Loaded = false;
	Movie2Loaded = true;
	disableMenuBtn(); //function to disable the menu item if swf of this menu has already been loaded
	
} else if (Joe3Boolean == true) {
	var i:Number = 2;
	removeMovieClip(objectsInScene*.PreLoader_mc);
	Tweener.addTween(objectsInScene*.base,{_xscale:Stage.width, _yscale:Stage.height, _alpha:100, time:1, transition:"easeOutQuad"});
	Movie1Loaded = Movie2Loaded = Movie4Loaded = false;
	Movie3Loaded = true;
	disableMenuBtn(); //function to disable the menu item if swf of this menu has already been loaded
	
} else if (Joe4Boolean == true) {
	var i:Number = 3;
	removeMovieClip(objectsInScene*.PreLoader_mc);
	Tweener.addTween(objectsInScene*.base,{_xscale:Stage.width, _yscale:Stage.height, _alpha:100, time:1, transition:"easeOutQuad"});
	Movie1Loaded = Movie2Loaded = Movie3Loaded = false;
	Movie4Loaded = true;
	disableMenuBtn(); //function to disable the menu item if swf of this menu has already been loaded
}

};

loadClip() has its own listeners, it tell you how much is loaded and can control a specific loadbar for the item loading

that should sort out your loadedbar problem and improve your “loaded” variables

var myMCL = new MovieClipLoader();
/*********************************************************************/
//callbacks
myMCL.onLoadStart = function(targetMC) {
var loadProgress = myMCL.getProgress(targetMC);
};
myMCL.onLoadProgress = function(targetMC, loadedBytes, totalBytes) {
// myTrace (“movie clip: " + targetMC);
bigpreview.preloader.preload_bar._xscale = (loadedBytes/totalBytes)*100;
viewer.bar.preload_bar._xscale = (loadedBytes/totalBytes)*100;
if (loadedBytes == totalBytes) {
viewer.bar._visible = false;
} else {
viewer.bar._visible = true;
}
//xmlNode.childNodes[selectedNum].childNodes[itemNumber].childNodes[2].childNodes[myVar-1].attributes.url
};
myMCL.onLoadComplete = function(targetMC) {
//trace(“TYU”+ targetMC._width + targetMC._height)
//myTrace (targetMC + " has finished loading.”);
var loadProgress = myMCL.getProgress(targetMC);
if (targetMC == file0) {
//
file0.gotoAndStop(itemNumber);
}
};
myMCL.onLoadInit = function(targetMC) {
trace(“TYU”+targetMC._width+targetMC._height);
};
myMCL.onLoadError = function(targetMC, errorCode) {
trace(“error:”+errorCode+" "+targetMC);
};

Thanks for your help so far. It may sounds dumb but i have tried one or two things but i cant make start from 0 when the preloader starts again…
Can you help me in that problem please. Dunno what exactly to write and where to put the piece of code cuz so far my changes (in the onLoadProgress) havent help much…:slight_smile:

Thank you

daft but I bet you have code somewhere telling it to be at 20% :stuck_out_tongue:

post the fla, but I don’t promise anything

GOING INSANE HERE…dumb mistake…it was the *.25 in the onLoadProgress in the function making the preloaders work. Think too much code running thru my head, everything starts looking the same…lol…

Thanks so much for your quick replies and putting me on the right track…

Jerome