How about a good prototype preloader?
U just type
holder.loadhere(x,y,"somemovie.swf","nameofmovie");
It will show a loading bar and preload your movie into holder movieclip.
Just copy-paste this code to your first frame, first scene.
Then use in root or in an instance.
eg. mc1.loadhere(0,0,“pic1.jpg”,“pic1”)
then the path of the loaded movie is _root.mc1.pic1
Maybe the code is a little bit dirty :x
If you have a question or suggestion… post it!
movieClip.prototype.loadhere=function(x,y,path,name) {
// creates and positions clip, bar and text
var containerText=name+"text";
var containerBar=name+"bar";
this.createEmptyMovieClip(name,1);
this.createEmptyMovieClip(containerText,2);
this.createEmptyMovieClip(containerBar,3);
this[name]._x=x;
this[name]._y=y;
this[containerText]._x=x;
this[containerText]._y=y;
this[containerBar]._x=x;
this[containerBar]._y=y;
// draws the bar
with (this[containerBar]){
beginFill (0xDDDDDD, 50);
lineStyle (1, 0x000000, 100);
moveTo (0, 0);
lineTo (80, 0);
lineTo (80, 20);
lineTo (0, 20);
lineTo (0,0);
endFill();
}
// loads movie
this[name].loadMovie(path);
var movie=this[name];
var prelText=this[containerText];
var prelBar=this[containerBar];
// sets new text format
var formtext=new TextFormat();
formtext.color="0x000000";
formtext.font="_sans";
formtext.align="center";
prelText.createTextField("loadtext",50,0,0,80,20);
prelText.loadtext.border=false;
// defines text display
prelText.onEnterFrame=function() {
if(this.percent!=100) {
this.percent=int((movie.getBytesLoaded()/movie.getBytesTotal())*100)
this.loadtext.text="Loading "+this.percent+"%";
this.loadtext.setTextFormat(formtext);
prelBar._xscale=this.percent;
}
if(this.percent==100) {
delete this.onEnterFrame;
this.removeMovieClip();
prelBar.removeMovieClip();
}
}
}
//end prototype
Make sure you run it in server enviroment just to see preloader, or using xat.com WebSpeed simulator (not advertising it)