PDA

View Full Version : Need a little help tweaking my preloader code...



mgomez03
August 8th, 2005, 02:06 PM
My main .swf file is 3 frames with the preloader residing in frame 1. I'm trying to get my preloader to skip frame 2 and jump straight to frame 3 if it's already cached... otherwise, go to and stop at frame 2 if it has not.

Why would I want it to do that? I have a little movie clip on frame 2 that lets the user know that loading is complete but I'm noticing it's always popping up everytime the movie is run -- I only want that movie clip on frame 2 to appear when it's loaded for the very first time. I've been using this code so far:



onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent = ((loading / total) * 100);
current = int(percent) + "%";
if (loading == total) {
_parent.gotoAndStop (3);
} else {
if (percent > 99) {
_parent.gotoAndStop(2);
}
}
}


I'm guessing my problem is that it'll never skip frame 2 and always go to frame 2 followed by 3 regardless because both arguments eventually reach a fully loaded state. I thought about using somekind of loop but not exactly sure how that would solve things. Any suggestions?

mgomez03
August 8th, 2005, 05:07 PM
gah, nm. know what to do now.