Preloading Problems Part 1 (flash 5)

Preload Problems (F5)

Aliteration asides, I am having a problem with my preloader.

The setup:

  • base SWF in which external SWF’s are being loaded in a MC called ‘content’ ( loadMovie (“content1.swf”, “content”); ) and there is a Cover-over animation called Cover.

  • preload code in frame 1 of the external SWF:

//checks to see if the external movie (this) is fully loaded
if (this.getBytesLoaded()<this.getBytesTotal()) {
Total = this.getBytesTotal()/1000;
Received = this.getBytesLoaded()/1000;
Percentage = (Received/Total)*100;
//tell the progress bar animation (located in the cover mc)
//to go to a frame between 0 and 100
_root.cover.loadBar.gotoAndStop(int(Percentage));
} else {
//when its fully loaded
gotoAndPlay(3);
//tell the cover mc to play its opening animation
_root.cover.gotoAndPlay(“open”);
}

on frame 2 of the external SWF there is the code: gotoAndPlay(1); (obviously)

  • when SWF is being loaded, there is a cover-over effect ( COVER ), which stops when it is closed at the loading bar (instance name loadBar), the loadingbar moves to frame 100 (that is, till the final bytes of the external SWF) and when finished it plays the ‘open’ animation and the newly loaded SWF appears.

And that works…, the bar appears, the SWF loads, the cover animation works… hooray!.. or is it…?

The problem

Well, I just noticed the following… checking the site online (on a v90 slow modem), I found out that each time that I loadMovie an external SWF… first the loading bar moves smoothly to the end of the bartrack, then it repeats that (while the SWF should have been finished loading, or the bar should not have arrived yet till the end)…
And then even for the third time the loading bar starts from scratch, this time more shaky (i guess the way it logically should look) and after this third time it finally completes loading the external SWF and the Cover Open animation is being played…
**So the loadingbar shows it’s animation 3 times before the SWF is loaded! **

So something goes terribly wrong… 2 times to be precise… but what is it???

some more investigating showed that when something loads fast it is that the loading bar doesn’t seem to reach the end before the Open Cover sequence kicks in…

so it seems that the amount to be loaded and the progress of the loadingbar are completely unrelated… thus the preloader now functions for show, not actually displaying the amount to be preloaded…

anyone?

is their a stop action included on the last frame?

the last frame of what?

cover
loadBar
or external SWF

?

nevermind i got it :slight_smile:
thanks anyway!

hey hold on, this is my problem :wink:

sorry about that the last frame of the layer where you have all of your actions for the preloader

oh I see.

yep.

let me know if that works

that would be the external SWF, and yes, I do have a stop() there.

thanks anyway though.

no not the external SWF
it should be in the loader.

If you go to the preloader tutorial on this site, they have a completed version and its on the completed version but not in the tutorial.
then you put in the command to load the external SWF

onClipEvent (enterFrame) {
var bytes = _root.getBytesTotal();
var bytes_loaded = _root.getBytesLoaded();
if (bytes_loaded == bytes) {
_root.gotoAndPlay(2);
this.kirupatxt = “movie loaded”;
} else {
_root.gotoAndStop(1);
this.kirupatxt = “loading (” + bytes_loaded + “/” + bytes +")";

}

}

you mean roughly this one…

would this one also work as a function which:

  • is always in the cover MC in the main.SWF as part of the loadBar
  • while with it always an external SWF is being preloaded, regardless of it’s byte size?

wow
umm actually the stop function is only 2 lines…i’m at work right now so i can’t tell you exactly what i put but ill post it as soon as i get home.

stop();
loadMovieNum(“gallery.swf”, 0);

this is how my last frame of the action layer in my loader looks