# Preload multiple swf's problem!

**URL:** <https://forum.kirupa.com/t/preload-multiple-swfs-problem/28846>\
**Category:** Uncategorized\
**Created:** [August 19, 2003, 9:39am UTC](https://forum.kirupa.com/t/preload-multiple-swfs-problem/28846 "2003-08-19T09:39:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Inflicted](https://avatars.discourse-cdn.com/v4/letter/i/82dd89/32.png) [@Inflicted](https://forum.kirupa.com/u/Inflicted)\
**Post date:** [August 19, 2003, 9:39am UTC](https://forum.kirupa.com/t/preload-multiple-swfs-problem/28846/1 "2003-08-19T09:39:51Z")

</div>

I have a movie with three buttons that load 3 external swf’s, with a preloader. Now I want all the external swf’s to have a preloader as well. So I used the preloader script on the 3 external swf’s, but when I test it, the movie starts at the first frame, where the preloader of the first swf is supposed to start, but nothing happens. Anyone have a clue, or maybe know a tutorial on this?

regards

---

<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 19, 2003, 9:45am UTC](https://forum.kirupa.com/t/preload-multiple-swfs-problem/28846/2 "2003-08-19T09:45:14Z")

</div>

What code did you use for the preloaders on the external swfs ?

---

<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 19, 2003, 9:52am UTC](https://forum.kirupa.com/t/preload-multiple-swfs-problem/28846/3 "2003-08-19T09:52:32Z")

</div>

Thanks for your 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:** [August 19, 2003, 9:55am UTC](https://forum.kirupa.com/t/preload-multiple-swfs-problem/28846/4 "2003-08-19T09:55:19Z")

</div>

something went wrong there!

On the first frame:

bytes\_loaded = Math.round(\_root.getBytesLoaded());  
bytes\_total = Math.round(\_root.getBytesTotal());  
getPercent = bytes\_loaded/bytes\_total;  
\_root.loadBar.\_width = getPercent_100;  
\_root.loadText = Math.round(getPercent_100)+"%";  
if (bytes\_loaded == bytes\_total) {  
\_root.gotoAndStop(3);  
}

---

<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 19, 2003, 9:57am UTC](https://forum.kirupa.com/t/preload-multiple-swfs-problem/28846/5 "2003-08-19T09:57:05Z")

</div>

Sorry, my reply was too long I guess…

second frame: gotoAndPlay(1);  
third frame: stop();

---

<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 19, 2003, 10:41am UTC](https://forum.kirupa.com/t/preload-multiple-swfs-problem/28846/6 "2003-08-19T10:41:47Z")

</div>

I see. The problem is you used \_root instead of this. When a movie is loaded into another they share \_root, which is why your preloader doesn’t work. Replace your code with this:

[AS]  
bytes\_loaded = Math.round(this.getBytesLoaded());  
bytes\_total = Math.round(this.getBytesTotal());  
getPercent = bytes\_loaded/bytes\_total;  
this.loadBar.\_width = getPercent_100;  
this.loadText = Math.round(getPercent_100)+"%";  
if (bytes\_loaded == bytes\_total) {  
this.gotoAndStop(3);  
}  
[/AS]

---

<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 19, 2003, 11:01am UTC](https://forum.kirupa.com/t/preload-multiple-swfs-problem/28846/7 "2003-08-19T11:01:45Z")

</div>

O.K., I solved it, thank you! I had to to change the script in the external swf as well, which I now find logical. Now I have to try to understand WHY this is logical. I still have problems with this \_root phenomenon, any tutorial suggestions?  
Thanks again

groeten!

- if you’re interested in art check www.inflicted.nl
