# Multiple Preloaders on One Page

**URL:** <https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813>\
**Category:** flash\
**Created:** [August 22, 2004, 3:35am UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813 "2004-08-22T03:35:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![meckinhoodle](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@meckinhoodle](https://forum.kirupa.com/u/meckinhoodle)\
**Post date:** [August 22, 2004, 3:35am UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/1 "2004-08-22T03:35:10Z")

</div>

Hi ya all, my first night here, I’m trying to place three individual pre-loaders on my home page (url: [http://ispice.us](http://ispice.us/)). I want the page divvied into three sections; three different movie clips; three different pre-loaders. The page is 760x480 pixels, I want the bottom MC (760x74 pxl area) to load first, so visitors can check out the info in it while the Main MC loads. i want the top Navigation (760x48) to load second; and, the Main MC; which has the most frames; to load last. If you visit the site you will not see any preloader at all, simply because I’ve only been able to get one placed correctly, and working, I have not bothered re-publishing the page because I want THREE pre-loaders on the page.  
The code I’ve used to place my one pre-loader is this:  
onClipEvent (enterFrame) {  
loading = \_parent.getBytesLoaded();  
total = \_parent.getBytesTotal();  
percent -= (percent-((loading/total)_100))_.25;  
per = int(percent);  
percentage = per+"%";  
loadBar.\_width = per;  
if (percent\>99) {  
\_parent.gotoAndStop(2);  
}  
}

It works fine but, as I said, I want three on the page, one for each of the three sections. I’ve tried and tried, but, have not been successful at figuring out how to get three individual pre-loaders to work; when the page is loaded.

I started this early this afternoon; thought it would be a quick add on to my project but; as often is; it’s taking much longer than I anticipated. My eyes have begun to hurt, again, from the strain. Please, oh please, assist me if you can! I hope you wise ones can solve this and show how good you really are!

PS. Kirupa is the best. I’ve learned so much from the site.

---

<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:** [August 22, 2004, 8:21am UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/2 "2004-08-22T08:21:16Z")

</div>

> [@meckinhoodle](#):
>
> Hi ya all, my first night here, I’m trying to place three individual pre-loaders on my home page (url: [http://ispice.us](http://ispice.us/)). I want the page divvied into three sections; three different movie clips; three different pre-loaders. The page is 760x480 pixels, I want the bottom MC (760x74 pxl area) to load first, so visitors can check out the info in it while the Main MC loads. i want the top Navigation (760x48) to load second; and, the Main MC; which has the most frames; to load last. If you visit the site you will not see any preloader at all, simply because I’ve only been able to get one placed correctly, and working, I have not bothered re-publishing the page because I want THREE pre-loaders on the page.  
> The code I’ve used to place my one pre-loader is this:  
> onClipEvent (enterFrame) {  
> loading = \_parent.getBytesLoaded();  
> total = \_parent.getBytesTotal();  
> percent -= (percent-((loading/total)_100))_.25;  
> per = int(percent);  
> percentage = per+“%”;  
> loadBar.\_width = per;  
> if (percent\>99) {  
> \_parent.gotoAndStop(2);  
> }  
> }
> 
> It works fine but, as I said, I want three on the page, one for each of the three sections. I’ve tried and tried, but, have not been successful at figuring out how to get three individual pre-loaders to work; when the page is loaded.
> 
> I started this early this afternoon; thought it would be a quick add on to my project but; as often is; it’s taking much longer than I anticipated. My eyes have begun to hurt, again, from the strain. Please, oh please, assist me if you can! I hope you wise ones can solve this and show how good you really are!
> 
> PS. Kirupa is the best. I’ve learned so much from the site.

in the first frame  
3 textfields, variable names t1,t2,t3

stop();  
for (var j =1; j\<4; j++) {  
clip = createEmptyMovieClip(“paper”+j, j);  
//position where you want  
clip.\_x = 100_j;  
}  
assessLoad = function (clip, myvar) {  
clip.kbLoaded = Math.floor(clip.getBytesLoaded()/1024);  
clip.kbTotal = Math.floor(clip.getBytesTotal()/1024);  
clip.percent = clip.kbLoaded/clip.kbTotal;  
//if you want animation/loading bar etc reference here  
//eg \_root[“loadingbar”+myvar].\_width blah blah…  
\_root[“t”+myvar] = Math.floor(clip.percent_100)+“%”;  
if ((clip.kbLoaded == clip.kbTotal) && clip.kbTotal\>1) {  
\_root[“t”+myvar] = “loaded”;  
clearInterval(\_root[“myInterval”+myvar]);  
}  
};  
loadMovie(“pic1.jpg”, paper1);  
loadMovie(“pic2.jpg”, paper2);  
loadMovie(“pic3.jpg”, paper3);  
myInterval1 = setInterval(assessload, 20, paper1, 1);  
myInterval2 = setInterval(assessload, 20, paper2, 2);  
myInterval3 = setInterval(assessload, 20, paper3, 3);

[http://www.gifsrus.com/testfile/fadeinout/multiloaderprel.swf](http://www.gifsrus.com/testfile/fadeinout/multiloaderprel.swf)

You could instead just make a preloader in the first frame of each movie

---

<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:** [August 24, 2004, 1:08pm UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/3 "2004-08-24T13:08:26Z")

</div>

K this question is semi related… i just didnt want to create another thread and crown the forums…

anywayz ny question is:

How do i create muliple preloaders that occur at different parts of my movie…

reasoning:

I’m creating a game and some of my friends still run dialup so i know that even a game over 3mb will take them over 10 minutes to load…  
My game will have levels and i thought it would be easier for my friends and people on slower connections to have the level load before it’s played.

I’m not exatly sure how to do this though… i know how to create a preload but this is somewhat different my friends.

any help

---

<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:** [August 24, 2004, 3:45pm UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/4 "2004-08-24T15:45:27Z")

</div>

> [@johnredcorn](#):
>
> K this question is semi related… i just didnt want to create another thread and crown the forums…
> 
> anywayz ny question is:
> 
> How do i create muliple preloaders that occur at different parts of my movie…
> 
> reasoning:
> 
> I’m creating a game and some of my friends still run dialup so i know that even a game over 3mb will take them over 10 minutes to load…  
> My game will have levels and i thought it would be easier for my friends and people on slower connections to have the level load before it’s played.
> 
> I’m not exatly sure how to do this though… i know how to create a preload but this is somewhat different my friends.
> 
> any help

Is you movie divided up into several movies or just one big one.

---

<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:** [August 24, 2004, 4:40pm UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/5 "2004-08-24T16:40:26Z")

</div>

its one big movie…

the first frame i have in the first scene is a preloader ( ready to take out if thats wat it takes)

the second frame is the start screen

thrid frame credits

and the forth frame i was gonna have a few mc’s for my game.

then i was thinking for each new level id put it on the first frame on a new scene

---

<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:** [August 24, 2004, 5:36pm UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/6 "2004-08-24T17:36:03Z")

</div>

> [@johnredcorn](#):
>
> its one big movie…
> 
> the first frame i have in the first scene is a preloader ( ready to take out if thats wat it takes)
> 
> the second frame is the start screen
> 
> thrid frame credits
> 
> and the forth frame i was gonna have a few mc’s for my game.
> 
> then i was thinking for each new level id put it on the first frame on a new scene

You really need to have a look at the bandwidth profile thing.But at the start I would do something like this  
stop();  
assessLoad = function (clip) {  
var kbLoaded = Math.floor(clip.getBytesLoaded()/1024);  
var kbTotal = Math.floor(clip.getBytesTotal()/1024);  
percent = kbLoaded/kbTotal;  
percent\_txt.text = Math.floor(percent\*100)+“%”;  
if ((kbLoaded\>=kbTotal/20) && kbTotal\>1) {  
clip.gotoAndStop(“startframe”);  
}  
if ((kbLoaded\>=kbTotal/10) && kbTotal\>1) {  
clip.gotoAndStop(“credits”);  
}  
if ((kbLoaded\>=kbTotal/5) && kbTotal\>1) {  
clip.gotoAndStop(“startGame”);  
}  
if ((kbLoaded\>=kbTotal) && kbTotal\>1) {  
clearInterval(myInterval);  
}  
};  
myInterval = setInterval(assessload, 50, this);

it really depends upon how you have made it and you`ll have to experiment with how much you have to preload in order to “stream”.

---

<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:** [August 24, 2004, 7:08pm UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/7 "2004-08-24T19:08:54Z")

</div>

hmm…

is there an easier way… like make each level a different fla or something…

or maybe each one a different movie clip…

thats prob easier rite

---

<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:** [August 24, 2004, 7:24pm UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/8 "2004-08-24T19:24:28Z")

</div>

onClipEvent (enterFrame) {  
\_root.loadMovie(“url of swf here”)  
}

added that to an mc on frame 4.

this will load the first level and at the end of the first level ill create another so it keep adding on… i think thats a good idea eh.

also… question… for the place where i put the url of my swf… is that all i can do…

like does the swf im loading have to be on a swf file hosted on the internet or is there another way…

ALso if there is a better way to do this please say

---

<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:** [August 24, 2004, 7:24pm UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/9 "2004-08-24T19:24:57Z")

</div>

> [@johnredcorn](#):
>
> hmm…
> 
> is there an easier way… like make each level a different fla or something…
> 
> or maybe each one a different movie clip…
> 
> thats prob easier rite

hmmm, its not terribly difficult.  
I asked if you were using one big file or several, if you are using several use

stop();  
createEmptyMovieClip(“paper”, 1);  
assessLoad = function (clip) {  
var kbLoaded = Math.floor(clip.getBytesLoaded()/1024);  
var kbTotal = Math.floor(clip.getBytesTotal()/1024);  
percent = kbLoaded/kbTotal;  
percent\_txt.text = Math.floor(percent\*100)+“%”;  
if ((kbLoaded == kbTotal) && kbTotal\>1) {  
// do whatever  
clearInterval(myInterval);  
}  
};

whenever you want to load something  
loadMovie(“levelwhatever.swf”, “paper”);  
myInterval = setInterval(assessload, 50, paper);

---

<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:** [August 24, 2004, 9:42pm UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/10 "2004-08-24T21:42:08Z")

</div>

wat the paper stand for…

---

<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:** [August 24, 2004, 9:42pm UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/11 "2004-08-24T21:42:41Z")

</div>

and is there a way to load everything if i am using one big file

---

<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:** [August 24, 2004, 9:44pm UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/12 "2004-08-24T21:44:58Z")

</div>

> [@johnredcorn](#):
>
> wat the paper stand for…

its an empty movieclip  
the way you suggested, you are loading it to \_root. This would wipe everything else off.

---

<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:** [August 24, 2004, 9:55pm UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/13 "2004-08-24T21:55:12Z")

</div>

> [@johnredcorn](#):
>
> and is there a way to load everything if i am using one big file

I think the best thing for you to do would be for the user to pick their level straight away(seperate .swf) so that this can be instantly loading, then you can show the credits etc while this is happening.we have all become obsessed with preloading but if you can get away with only loading say 30% of the movie before the user starts to play and it still runs smoothly(continues loading while playing) then it is much better.

---

<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:** [August 25, 2004, 12:34am UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/14 "2004-08-25T00:34:12Z")

</div>

> [@stringy](#):
>
> I think the best thing for you to do would be for the user to pick their level straight away(seperate .swf) so that this can be instantly loading, then you can show the credits etc while this is happening.we have all become obsessed with preloading but if you can get away with only loading say 30% of the movie before the user starts to play and it still runs smoothly(continues loading while playing) then it is much better.

ya but the fun of the game is not knowing exactly wats gonna happen in the level or the storyline to it… example if they choose a desert level and lets say there was some sorta mummy …( insert interesting storline )

the people wouldnt know whats going on and that can really make the user feel like the game is a no smoe game…

anywayz if there is a way to use multiple preloading and still only have 1 fla file i would like to know…

ex - each preloader preloads a scene?

if not ill use ur way but preferably id like 2 know this way so its easier on the user

---

<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:** [August 25, 2004, 12:36am UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/15 "2004-08-25T00:36:03Z")

</div>

possibly the load frame function?

---

<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:** [August 25, 2004, 2:11am UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/16 "2004-08-25T02:11:53Z")

</div>

meck, I’am also looking into doing exactly what you want to do. If I find out how I will post in kirupa. But if you foind out how first please message me back. thanks.

---

<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:** [August 25, 2004, 3:07am UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/17 "2004-08-25T03:07:44Z")

</div>

np…

ill post it too

---

<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:** [August 25, 2004, 5:59am UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/18 "2004-08-25T05:59:17Z")

</div>

> [@johnredcorn](#):
>
> ya but the fun of the game is not knowing exactly wats gonna happen in the level or the storyline to it… example if they choose a desert level and lets say there was some sorta mummy …( insert interesting storline )
> 
> the people wouldnt know whats going on and that can really make the user feel like the game is a no smoe game…
> 
> anywayz if there is a way to use multiple preloading and still only have 1 fla file i would like to know…
> 
> ex - each preloader preloads a scene?
> 
> if not ill use ur way but preferably id like 2 know this way so its easier on the user

You should not use scenes for this sort of thing, you will only run into problems.The way outlined above is what i`d try.  
When you use a preloader, all you are doing is stopping the timeline and playing some animation while more frames (external movies etc) load so if you are clever about it, you will not have to load 100% before starting to play.  
Having said that Have a look at this  
[http://www.gifsrus.com/testfile/hierachyprel8.swf](http://www.gifsrus.com/testfile/hierachyprel8.swf) (ignore the random text- this whole thing was just quickly made to test a preloader idea.)  
This is 6 movies which just load in order but if you click a button in the meantime( maybe your user makes a different choice) then the order changes and that movie becomes priority.  
This is just using the same code as above.

---

<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:** [August 25, 2004, 4:52pm UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/19 "2004-08-25T16:52:52Z")

</div>

so i add this to everyone of my bars and it shall make it a preloader?

stop();  
createEmptyMovieClip(“paper”, 1);  
assessLoad = function (clip) {  
var kbLoaded = Math.floor(clip.getBytesLoaded()/1024);  
var kbTotal = Math.floor(clip.getBytesTotal()/1024);  
percent = kbLoaded/kbTotal;  
percent\_txt.text = Math.floor(percent\*100)+"%";  
if ((kbLoaded == kbTotal) && kbTotal\>1) {  
// do whatever  
clearInterval(myInterval);  
}  
};

i dun really get tat

maybe post ur 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:** [August 25, 2004, 5:13pm UTC](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813/20 "2004-08-25T17:13:16Z")

</div>

> [@johnredcorn](#):
>
> so i add this to everyone of my bars and it shall make it a preloader?
> 
> stop();  
> createEmptyMovieClip(“paper”, 1);  
> assessLoad = function (clip) {  
> var kbLoaded = Math.floor(clip.getBytesLoaded()/1024);  
> var kbTotal = Math.floor(clip.getBytesTotal()/1024);  
> percent = kbLoaded/kbTotal;  
> percent\_txt.text = Math.floor(percent\*100)+“%”;  
> if ((kbLoaded == kbTotal) && kbTotal\>1) {  
> // do whatever  
> clearInterval(myInterval);  
> }  
> };
> 
> i dun really get tat
> 
> maybe post ur fla?

no, its just a function which you would have on the timeline and call each time you use loadMovie.  
Its pointless me uploading the .fla.  
If you want to upload a basic draft of your game, i`ll see if i can break it up for you.

[Next page](https://forum.kirupa.com/t/multiple-preloaders-on-one-page/61813.md?page=2)
