Bonjour,
I’ve got this neat little preloader prototype that I love to use… Question is, how can I change the code up so that it alpha/fades in and then once it’s complete, fades out?
Preloader = function (clip) {
this.clip = clip ? clip : _root;
this.beginFunction();
this.loader = _root.createEmptyMovieClip('loadBar', 1);
this.loader.createEmptyMovieClip('l', 1);
this.loader.preloader = this;
trace(Stage.width);
this.loader._x = Stage.width/2;
this.loader._y = Stage.height/2;
};
Preloader.prototype.init = function() {
with (this.loader) {
lineStyle(0, 0x000000, 30);
beginFill(0x666666, 30);
moveTo(-50, -3);
lineTo(50, -3);
lineTo(50, 3);
lineTo(-50, 3);
endFill();
}
this.loader.onEnterFrame = function() {
this.preloader.run();
};
};
Preloader.prototype.run = function() {
var bTotal = this.clip.getBytesTotal();
var bLoaded = this.clip.getBytesLoaded();
var percentLoaded = (bLoaded/bTotal)*100;
with (this.loader.l) {
lineStyle(0, 0x000000, 30);
beginFill(0x666666, 30);
moveTo(-50, -3);
lineTo(-50+percentLoaded, -3);
lineTo(-50+percentLoaded, 3);
lineTo(-50, 3);
endFill();
}
if (bLoaded == bTotal) {
this.endFunction();
removeMovieClip(this.loader);
}
};
Preloader.prototype.beginFunction = function() {
this.clip.gotoAndStop(1);
};
Preloader.prototype.endFunction = function() {
this.clip.gotoAndPlay(2);
};
this.mainLoad = new Preloader();
this.mainLoad.init();
Thank you in advance! :flower: