# Preloading Problems Part 1 (flash 5)

**URL:** <https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104>\
**Category:** flash\
**Created:** [July 19, 2003, 2:53pm UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104 "2003-07-19T14:53:14Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericinho](https://avatars.discourse-cdn.com/v4/letter/e/9dc877/32.png) [@ericinho](https://forum.kirupa.com/u/ericinho)\
**Post date:** [July 19, 2003, 2:53pm UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104/1 "2003-07-19T14:53:14Z")

</div>

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???

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 19, 2003, 6:18pm UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104/2 "2003-07-19T18:18:19Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 20, 2003, 2:49pm UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104/3 "2003-07-20T14:49:40Z")

</div>

is their a stop action included on the last frame?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 20, 2003, 5:45pm UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104/4 "2003-07-20T17:45:23Z")

</div>

the last frame of what?

cover  
loadBar  
or external SWF

?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2003, 2:55am UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104/5 "2003-07-21T02:55:08Z")

</div>

nevermind i got it 🙂  
thanks anyway!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2003, 6:13am UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104/6 "2003-07-21T06:13:38Z")

</div>

hey hold on, this is my problem 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2003, 6:10pm UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104/7 "2003-07-21T18:10:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 22, 2003, 5:59am UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104/8 "2003-07-22T05:59:10Z")

</div>

oh I see.

yep.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 22, 2003, 11:41am UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104/9 "2003-07-22T11:41:53Z")

</div>

let me know if that works

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 22, 2003, 12:21pm UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104/10 "2003-07-22T12:21:09Z")

</div>

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

thanks anyway though.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 22, 2003, 2:08pm UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104/11 "2003-07-22T14:08:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 22, 2003, 3:52pm UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104/12 "2003-07-22T15:52:47Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 22, 2003, 8:44pm UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104/13 "2003-07-22T20:44:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 22, 2003, 10:20pm UTC](https://forum.kirupa.com/t/preloading-problems-part-1-flash-5/26104/14 "2003-07-22T22:20:47Z")

</div>

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

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