# What kind of preloader?

**URL:** <https://forum.kirupa.com/t/what-kind-of-preloader/24774>\
**Category:** flash\
**Created:** [July 4, 2003, 3:14pm UTC](https://forum.kirupa.com/t/what-kind-of-preloader/24774 "2003-07-04T15:14:54Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![charliealpha](https://avatars.discourse-cdn.com/v4/letter/c/45deac/32.png) [@charliealpha](https://forum.kirupa.com/u/charliealpha)\
**Post date:** [July 4, 2003, 3:14pm UTC](https://forum.kirupa.com/t/what-kind-of-preloader/24774/1 "2003-07-04T15:14:54Z")

</div>

Hi,

So very very close to finishing this thing. Only thing left is a preloader.

I’m reading the tuts and they all seem to accomodate for 1 movie. Seeing as my full flash site is an amalgamation of many movies, will it matter? Will the entire site load up if I only make the preloader on the first movie?

Like most sites, the ‘Work’ page has images that have bumped up the size of the swf and its considerably bigger than the first introducting movie ‘Main’.

confuzzled again.

---

<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 4, 2003, 3:19pm UTC](https://forum.kirupa.com/t/what-kind-of-preloader/24774/2 "2003-07-04T15:19:17Z")

</div>

it depends on when you are loading the extra movies. If the command to load them isn’t in the first frame of the main movie (or wherever the main movie will sit when it is preloading) then you won’t be able to preload the additional movies until the main one has loaded.

It might be that you need to preload the main movie first and then show little preloaders where and when your additional movies load, just use the preloader that preloads for one movie but have one preloader appear per movie you’re loading

if you’re loading several movies at the same time then you can make one preloader to accomodate them all but I’ll need to see your loading code to make one to suit your needs

Hope this helps 😛

---

<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 4, 2003, 3:32pm UTC](https://forum.kirupa.com/t/what-kind-of-preloader/24774/3 "2003-07-04T15:32:25Z")

</div>

> \*Originally posted by m\_andrews808 \*  
> **If the command to load them isn’t in the first frame of the main movie (or wherever the main movie will sit when it is preloading) then you won’t be able to preload the additional movies until the main one has loaded**

ok, so how do I do this. Seems to be the easiest way, then I can build a preloader for the entire site.

does that make sense?

---

<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 4, 2003, 3:43pm UTC](https://forum.kirupa.com/t/what-kind-of-preloader/24774/4 "2003-07-04T15:43:51Z")

</div>

not really sure what you mean but…

if you want to have one preloader for the whole site you’d do something like this (I’m assuming you’re using flash mx here, let me know if otherwise):

lets say this is you need to load 3 movies and you load them all in frame 1 of your main movie, this might be your code:

```auto

// load your movies
loadMovieNum("Movie1.swf", 1);
loadMovieNum("Movie2.swf", 2);
loadMovieNum("Movie3.swf", 3);

// caluculate load progress
this.onEnterFrame = function() {
          LoadSize = this.getBytesTotal() + _level1.getBytesTotal() + _level2.getBytesTotal() + _level3.getBytesTotal();
          LoadedBytes = this.getBytesLoaded() + _level1.getBytesLoaded() + _level2.getBytesLoaded() + _level3.getBytesLoaded();
          LoadProgress = (LoadedBytes / LoadTotal * 100) + "%";
}

```

now if you place a dynamic textfield on the stage on this frame and assign it a variable LoadProgress it will show you how much of your movie has loaded.

---

<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 4, 2003, 3:49pm UTC](https://forum.kirupa.com/t/what-kind-of-preloader/24774/5 "2003-07-04T15:49:45Z")

</div>

Does that really work? I´m not at my comp and won´t be for some days so I can´t test it myself. So if you get that to work please post a reply 🙂

---

<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 4, 2003, 4:25pm UTC](https://forum.kirupa.com/t/what-kind-of-preloader/24774/6 "2003-07-04T16:25:35Z")

</div>

Yes, the code is a keeper. It works…  
\>Mooler\< ROCK ON!!! You going to the Sanitarium show?

---

<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 4, 2003, 4:28pm UTC](https://forum.kirupa.com/t/what-kind-of-preloader/24774/7 "2003-07-04T16:28:36Z")

</div>

eek

_head explodes_

I’m off for beer.

---

<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 4, 2003, 6:26pm UTC](https://forum.kirupa.com/t/what-kind-of-preloader/24774/8 "2003-07-04T18:26:48Z")

</div>

but m\_andrews808, now your loading the mavies at the first frame.

doesn’t

this.onEnterFrame = function() {  
LoadSize = this.getBytesTotal();  
LoadedBytes = this.getBytesLoaded();  
LoadProgress = (LoadedBytes / LoadTotal \* 100) + “%”;  
}

Work?

---

<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 6, 2003, 11:53am UTC](https://forum.kirupa.com/t/what-kind-of-preloader/24774/9 "2003-07-06T11:53:33Z")

</div>

> \*Originally posted by jay-em \*  
> \*\*Yes, the code is a keeper. It works…  
> \>Mooler\< ROCK ON!!! You going to the Sanitarium show? \*\*

No sanitarium for me 😱 ´cause the show doesn´t reach sweden, buhuu but will be there next year when they headline theire own tour :geek:

PS. For all who gets irritated by this post I now it´s of topic but rock´n´roll is imortant 😉

---

<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 6, 2003, 1:55pm UTC](https://forum.kirupa.com/t/what-kind-of-preloader/24774/10 "2003-07-06T13:55:19Z")

</div>

[m] that only accounts for the load progress of \_level0 (the \_root movie) when you tell a seperate movie to load on top of that it doesn’t effect the \_root movie’s getBytesTotal so your code doesn’t account for 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 7, 2003, 11:00am UTC](https://forum.kirupa.com/t/what-kind-of-preloader/24774/11 "2003-07-07T11:00:05Z")

</div>

Thing is, if I apply this code to my movie, what ever is on level 3 replaces the movie thats _supposed_ to load.

[http://www.charliealpha.co.uk/sites/msp/main.fla](http://www.charliealpha.co.uk/sites/msp/main.fla)

---

<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 7, 2003, 11:04am UTC](https://forum.kirupa.com/t/what-kind-of-preloader/24774/12 "2003-07-07T11:04:39Z")

</div>

not a problem… just change the level its loaded into:

```auto

// load your movies
loadMovieNum("Movie1.swf", 1);
loadMovieNum("Movie2.swf", 2);
loadMovieNum("Movie3.swf", 4);

// caluculate load progress
this.onEnterFrame = function() {
        LoadSize = this.getBytesTotal() + _level1.getBytesTotal() + _level2.getBytesTotal() + _level4.getBytesTotal();
        LoadedBytes = this.getBytesLoaded() + _level1.getBytesLoaded() + _level2.getBytesLoaded() + _level4.getBytesLoaded();
        LoadProgress = (LoadedBytes / LoadTotal * 100) + "%";
}

```

or if you want to be safe:

```auto

// load your movies
loadMovieNum("Movie1.swf", 1);
loadMovieNum("Movie2.swf", 2);
loadMovieNum("Movie3.swf", 9999);

// caluculate load progress
this.onEnterFrame = function() {
        LoadSize = this.getBytesTotal() + _level1.getBytesTotal() + _level2.getBytesTotal() + _level9999.getBytesTotal();
        LoadedBytes = this.getBytesLoaded() + _level1.getBytesLoaded() + _level2.getBytesLoaded() + _level9999.getBytesLoaded();
        LoadProgress = (LoadedBytes / LoadTotal * 100) + "%";
}

```
