I’m over here putting together a tweened preloader that runs in time with bytes loaded. I’m just wondering how I could make the preloader movieclip fade out when the tween is finished and then advance the playhead when the alpha reaches 0. I can post an fla if that’ll help anyone understand better.
Heres the code on the preloader movieclip:
onClipEvent (load) {
if (_parent.getBytesTotal() == _parent.getBytesLoaded()) {
quickPlay = true;
} else {
preLoad = (_parent.getBytesTotal() * 0.75); //percent to preload
}
_parent.stop();
}
onClipEvent (enterFrame) {
gotoAndStop(loadedIndicatorFrame());
if (quickPlay == true) { //quickly play the anim
if (_currentframe == _totalframes) {
_parent.play();
}
} else { //wait for the preload
if (_parent.getBytesLoaded() >= preLoad) {
_parent.play();
}
}
}
Then this is on the main timeline in the preloader mc:
lastFrame = 1;
function loadedIndicatorFrame() {
var newFrame = int((_parent.getBytesLoaded() / _parent.getBytesTotal()) * 65) + 2;
if (newFrame - lastFrame > 4) { //too far
lastFrame += 4;
loadedText = int(_parent.getBytesTotal() / 1024 * (lastFrame - 2) / 65) + "kb of " + int(_parent.getBytesTotal() / 1024) + "kb";
} else if (newFrame - lastFrame > 0) { //normal move
lastFrame++;
loadedText = int(_parent.getBytesLoaded() / 1024) + "kb of " + int(_parent.getBytesTotal() / 1024) + "kb";
}
return lastFrame;
}
I’m guessing its just a simple script in the (enterFrame). Thanks for any help.