# Same preloader for multiple .swf's

**URL:** <https://forum.kirupa.com/t/same-preloader-for-multiple-swfs/29319>\
**Category:** Uncategorized\
**Created:** [August 25, 2003, 6:09pm UTC](https://forum.kirupa.com/t/same-preloader-for-multiple-swfs/29319 "2003-08-25T18:09:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![blueshift](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@blueshift](https://forum.kirupa.com/u/blueshift)\
**Post date:** [August 25, 2003, 6:09pm UTC](https://forum.kirupa.com/t/same-preloader-for-multiple-swfs/29319/1 "2003-08-25T18:09:56Z")

</div>

Ok, heres the code I’m trying to use  
[AS]function checkLoad(target){  
var lBytes = target.getBytesLoaded();  
var tBytes = target.getBytesTotal();  
var percentLoaded = Math.floor((lBytes/tBytes)\*100);  
loadbar.\_xscale = percentLoaded;

```
percentText = Math.floor(percentLoaded) + "% of " + Math.floor(tBytes/1024) + "KB loaded";

if(lBytes &gt;= tBytes && tBytes &gt; 0){
	if(count&gt;=12){
		clearInterval(checkProgress);
		loadbar._xscale = 0;
		percentText = "finished, yo"
	}
	else{
		count++;
	}
}
updateAfterEvent();

```

}[/AS]

and for the on(press) I just call checkLoad() and pass the name of the .swf I’m loading. It seems to work for the first movie that I load, but not for any I load after that.

Here are my files:  
[http://web.ics.purdue.edu/~rstremke//multi\_load2.zip](http://web.ics.purdue.edu/~rstremke//multi_load2.zip)

Theres a static preloader for all the movies; is that a pain, or should I just make a preloader in the beginning of each clip I load into the main movie?

Any help would be appreciated.

---

<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, 2003, 8:25pm UTC](https://forum.kirupa.com/t/same-preloader-for-multiple-swfs/29319/2 "2003-08-25T20:25:19Z")

</div>

put one on each swf is simpler

---

<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 26, 2003, 12:24am UTC](https://forum.kirupa.com/t/same-preloader-for-multiple-swfs/29319/3 "2003-08-26T00:24:05Z")

</div>

The other thing I thought of though, won’t the movieClip load before it plays? So the preloader wouldn’t even be seen. Anyways, I still can’t get this one to work, so any help is still welcome.

---

<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 26, 2003, 4:13am UTC](https://forum.kirupa.com/t/same-preloader-for-multiple-swfs/29319/4 "2003-08-26T04:13:34Z")

</div>

Anyone have anything to add to either post?

---

<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 26, 2003, 4:41am UTC](https://forum.kirupa.com/t/same-preloader-for-multiple-swfs/29319/5 "2003-08-26T04:41:09Z")

</div>

I didn’t open your files, but are you loading all the other swf’s into a movieClip with a unique name and changing ‘target’ to the name of the movieClip that it’s loading into? I put my code in two or three frames for preloaders like here:

> **[kirupa.com - Percentage Preloader with Load Bar](https://www.kirupa.com/developer/mx/percentagepreloader.htm)**
>
> Find out how you can create a useful preloader with a load bar.

But the easiest way:

> or should I just make a preloader in the beginning of each clip I load into the main movie?

…Yes…RelandR agrees…😛

---

<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 26, 2003, 5:12am UTC](https://forum.kirupa.com/t/same-preloader-for-multiple-swfs/29319/6 "2003-08-26T05:12:06Z")

</div>

my first post was sorta off the cuff (when in doubt - go the easy route)

I just d’lded your files and played it thru (swf) - but didn’t look yet at the fla.  
… it acted kinda buggy at first but a second time around was smooth (?)  
(if your using onPress that sometimes doesn’t behave as well as onRelease)

I think It probably just doesn’t have enough bytes in each one to need a preloader, therefore, unless you put in a _fake_ one of those… your not going to see anything of the _loading process_ until there is more content to load …

maybe lose the " finished yo" thingy or make it go away after a couple seconds (?)  
so it doesn’t seem to be some stalled statement - just hangin there

---

<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 26, 2003, 11:37am UTC](https://forum.kirupa.com/t/same-preloader-for-multiple-swfs/29319/7 "2003-08-26T11:37:28Z")

</div>

Yeah, the “finished” thing is just so it changes to something at the end, so I can tell if it works at all. The movies are all pretty small, but on a 56K, it still takes 2-3 seconds with nothing happening, I want to avoid that.
