# Preload external swfs -please read

**URL:** https://forum.kirupa.com/t/preload-external-swfs-please-read/16041
**Category:** Uncategorized
**Created:** [March 20, 2003, 1:27pm UTC](https://forum.kirupa.com/t/preload-external-swfs-please-read/16041 "2003-03-20T13:27:56Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![samstone](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@samstone](https://forum.kirupa.com/u/samstone)
#### Post date: [March 20, 2003, 1:27pm UTC](https://forum.kirupa.com/t/preload-external-swfs-please-read/16041/1 "2003-03-20T13:27:56Z")

</div>

Please HELP. I have individual swfs coming from a main swf. I need the preloader to work for the 5 swfs. I tried \_root, \_parent and \_this. ???

the following code on frame 1

bytes\_loaded = Math.round(this.getBytesLoaded());  
bytes\_total = Math.round(this.getBytesTotal());  
if (bytes\_loaded == bytes\_total) {  
this.gotoAndStop(3);  
}

the following code on frame 2

this.gotoAndPlay(1);

This code is on the swf that is being called to the main swf.  
WHat am I doing wrong?

---

<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: [March 20, 2003, 1:56pm UTC](https://forum.kirupa.com/t/preload-external-swfs-please-read/16041/2 "2003-03-20T13:56:03Z")

</div>

[…] if (bytes\_loaded == bytes\_total) […]  
should be  
[…] if (bytes\_loaded [COLOR=red]\>=[/COLOR] bytes\_total) […]

works 4 sure 😉

---

<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: [March 20, 2003, 2:37pm UTC](https://forum.kirupa.com/t/preload-external-swfs-please-read/16041/3 "2003-03-20T14:37:22Z")

</div>

still having a problem. Do I use this.getBytesLoaded

I’m not sure if its ,this, \_root or \_parent. I know people have external swfs coming up from the main.swf and need a preloader for these separate swf’s. THere’s got to be a way or I will lose my mind

---

<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: [March 20, 2003, 2:57pm UTC](https://forum.kirupa.com/t/preload-external-swfs-please-read/16041/4 "2003-03-20T14:57:18Z")

</div>

here’s my standart preloader AS code (just put it in actions tab for 2nd frame of main movie):

if (\_root.getBytesLoaded()/\_root.getBytesTotal()\>=1) {  
gotoAndPlay(3);  
} else {  
gotoAndPlay(1);  
}

---

<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: [March 21, 2003, 5:22am UTC](https://forum.kirupa.com/t/preload-external-swfs-please-read/16041/5 "2003-03-21T05:22:55Z")

</div>

i am using instance “content” to load 5 seperate swfs

What do I need to do for the preload on the individual swfs

\_root.content.getbytesloaded

or

this.getbytleloaded…

I can’t figute this out.

I tought it was a better thing to make a main movie with seperate movies loading ito it. But i can’t figure out the prload for the small swfs attahed to main 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: [March 21, 2003, 8:26am UTC](https://forum.kirupa.com/t/preload-external-swfs-please-read/16041/6 "2003-03-21T08:26:45Z")

</div>

hi,

i feel better is :

movieClip.getBytesLoaded() and movieClip.getBytesTotal()

the path (\_root / \_level …etc ) depend on where you load the movie.

if you load movie at level 2 you should use  
\_level2.movieClip.get…

if you load movie at \_root you should use  
\_root.movieClip.get…

* * *

## if(movieClip.getBytesLoaded() \>=movieClip.getBytesTotal()){ statement }

regards  
ajok  
[ajok@indiatimes.com](mailto:ajok@indiatimes.com)
