Hello,
I have an api preloader that I like to use. It would be great if it could fade out when the loader reaches 100, but I don’t know how to do it. Right now it just disappears when it reaches 100… is there something I can do? I’ll attach it to this post!
// api preloader
movieWidth = 795;
movieHeight = 560;
width = 100;
height = 6;
font = "Arial";
fontsize = 12;
borderColor = "0x000000";
innerColor = "0x000000";
this.createEmptyMovieClip("border", 1);
with (this.border) {
lineStyle(0, borderColor);
moveTo(0, 0);
lineTo(width, 0);
lineTo(width, height);
lineTo(0, height);
lineTo(0, 0);
border.createTextField("percent", 0, 0, height, width, height*6);
myformat = new TextFormat();
myformat.color = 0x000000;
myformat.align = "center";
myformat.font = font;
myformat.size = fontsize;
percent.selectable = false;
percent.setTextFormat(myformat);
}
this.border.createEmptyMovieClip("loadbar", 1);
with (this.border.loadbar) {
beginFill(innerColor, 100);
moveTo(0, 0);
lineTo(width-2, 0);
lineTo(width-2, height-2);
lineTo(0, height-2);
lineTo(0, 0);
endFill();
_xscale = 0;
_x += 1.5;
_y += 1.5;
}
border._x = movieWidth/2-border._width/2;
border._y = movieHeight/2-border._height/2;
this.onEnterFrame = function() {
with (this.border) {
_visible = true;
percentLoaded = Math.round(_root.getBytesLoaded()/_root.getBytesTotal()*100);
loadbar._xscale = Math.round(_root.getBytesLoaded()/_root.getBytesTotal()*100);
percent.text = percentLoaded+"% loaded";
percent.setTextFormat(myformat);
}
if (percentLoaded == 100) {
delete this.onEnterFrame;
border._visible = false;
nextFrame();
}
};
stop();