Never build a preloader ever again

having become fed up with all the questions about preloaders, i have made a preloader prototype for movie clips that anyone can use. attached to this post is a fla that allows you to preload movies with one simple command. the preloader is as a progress bar that expands from left to right - pretty standard.
you can choose your location, size, and color. the functions are very processor friendly, and won’t bog down slower machines.
have a nice day,
jeremy

p.s. mods: i know this isn’t a tutorial, but this seemed to be the most appropriate place to post this file.

LOL, thanks for that sinfiniti. I will check out that file in a little bit.

I was going to write a tutorial on my preloader since it is a no fail thing and people I have given it to were able to use it.

Just remember this, there will always be that group of people that still can’t make preloaders. So if yours is ever used, be pretty sure there will be questions on it…lol.

lol…my friend had done one before, here is the code :

/*

Flash MX - Preloader v1
(Inklusive Warteschleife)

posX = loader Position X
posY = loader Position Y
Breite = max width of the statusbar
Hoehe = height
Farbe = color of the statusbar
Warten = pause in secs.
Bild = which frame to go.
Signal = Frame Navigation (1: GotoAndPlay or 0: GotoAndStop)

*/

Movieclip.prototype.loader = function (posX,posY,Breite,Hoehe,Farbe,Warten,Bild,Signal) {
	
this.createEmptyMovieClip("pre",1);

pre.onEnterFrame = function () {
	
   // Position Preloader
   this._x = posX;
   this._y = posY;
   
   // Gesamt & Geladen 
   this.gesamt = _root.getBytesTotal();
   this.geladen = _root.getBytesLoaded();   
   
   // Prozentberechnung
   prozent = (int((this.geladen/this.gesamt)*100));
   
   // Statusbalken
   this.createEmptyMovieClip("bar", 2);   
   this.bar.beginFill (Farbe,100)
   this.bar.moveto(prozent*Breite/100,Hoehe);
   this.bar.lineto(prozent*Breite/100,0);
   this.bar.lineto(0,0);
   this.bar.lineto(0,Hoehe);
   this.bar.lineto(Hoehe,Hoehe);
   this.bar.endFill();
   
   // Textfeld
   this.createTextField("pFeld", 1, 0, 0, 100, 16);   
   this.pFeld.autoSize = "left";
   this.pFeld.selectable = false;
   this.pFeld._y += (Hoehe);   
   
   // Textfeld Format
   this.mForm = new TextFormat();
   this.mForm.font = "Arial";   
   this.mForm.size = 10;
   this.mForm.color = 0x000000;   
   this.pFeld.text = prozent + "%";
   this.pFeld.setTextFormat(this.mForm);   
   
   if (this.gesamt == this.geladen) {
	  _root.Pause(Warten,Bild,Signal);      	  
   }
}
}

MovieClip.prototype.Pause = function(pzeit,bild,Sig) {        
        this.stop();
		var go = function(obj) {				
      			pre.removeMovieClip();
				if (Sig) {
                	obj.gotoAndPlay(bild);
				} else {
					obj.gotoAndStop(bild);
				}
                clearInterval(id);
        }		
        var id = setInterval(go,pzeit*1000,this);
}

loader(200,200,150,10,0xFF0000,2,5,0);
stop();

Is it kinda similar, ill check yours now sinfiniti!

i left out the text field, but it’s pretty much the same thing. i was seeing a rebirth of the preloader questions lately and thought i’d try to end the mayhem.
:slight_smile:
jeremy

Good job jeremy, i think u should post that one into best of Kirupa.com! let us wait for lost and he may move that thread…lol

yAY, now i hopefully wont ahve to worry about them, lol, like ill make a site that is that complicated…

Actually, there was already one in the best of Kirupa, but people are too lazy to check it :frowning:
But someone will put it there soon, Sinf :slight_smile: Or we could do an AS trick of some sort.

And h88, could you translate the code? My german is a bit rusty…

pom :asian:

its a cool loader but people will still ask about loaders because people will always be trying to make there own amazing loaders and get stuck. Thank god I have at last figured out loaders it was the first thing i learnt really.

-Tom

i dont want to sound stupid, but could someone please be kind enough to tell me how to use the preloader that has been attached in the above message?

I hope someone is bothered to answer my question… I’ve been trying to make one since a week, and got nowhere :’(

Thanks