# Preloading external .swf problems

**URL:** https://forum.kirupa.com/t/preloading-external-swf-problems/7018
**Category:** Uncategorized
**Created:** [October 22, 2002, 6:38am UTC](https://forum.kirupa.com/t/preloading-external-swf-problems/7018 "2002-10-22T06:38:55Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![djozusa](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@djozusa](https://forum.kirupa.com/u/djozusa)
#### Post date: [October 22, 2002, 6:38am UTC](https://forum.kirupa.com/t/preloading-external-swf-problems/7018/1 "2002-10-22T06:38:55Z")

</div>

I’m trying to preload an external .swf…

In my main movie I have the folowing script:

loadMovieNum(“mainmovie.swf”,2);

* * *

In the external movie I have this code looping:

myBytesLoaded = \_parent.getBytesLoaded();  
myBytesTotal = \_parent.getBytesTotal()/percentLoad;  
if (myBytesLoaded\<myBytesTotal) {  
percentOutput = int((myBytesLoaded/myBytesTotal)\*100)+"%";  
setProperty(“loadbar”, \_xscale, (myBytesLoaded/myBytesTotal)\*100);  
} else {  
this.play();  
}

==========================================

The preloader works fine when I test the external movie by itself, but when it’s loaded externally it fails.

Please help, this is killing me.

---

<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: [October 22, 2002, 6:44am UTC](https://forum.kirupa.com/t/preloading-external-swf-problems/7018/2 "2002-10-22T06:44:49Z")

</div>

It should work fine…

Perhaps the \_parent is throwing it off.

Since you put a preloader on the main timeline, there is no need for \_root or \_parent.

And this.play() can just be play()

---

<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: [October 24, 2002, 1:14am UTC](https://forum.kirupa.com/t/preloading-external-swf-problems/7018/3 "2002-10-24T01:14:52Z")

</div>

I HAVE THE SAME PROBLEM!!!

:\*(

---

<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: [October 24, 2002, 4:10am UTC](https://forum.kirupa.com/t/preloading-external-swf-problems/7018/4 "2002-10-24T04:10:07Z")

</div>

I got mine to work.

1. make sure you are loading movie using the following:

loadMovieNum (“movie.swf”, 1);

1. the code that sits in the preloader movie clip on frame 1:

myBytesLoaded = \_parent.getBytesLoaded();

myBytesTotal = \_parent.getBytesTotal()/percentLoad;

if (myBytesLoaded \< myBytesTotal) {  
percentOutput = int((myBytesLoaded/myBytesTotal)\*100)+"%";

```
setProperty("loadbar", _xscale, (myBytesLoaded/myBytesTotal)*100);

```

}

else {  
\_parent.play();  
stop();  
}

Hope that 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: [October 24, 2002, 12:11pm UTC](https://forum.kirupa.com/t/preloading-external-swf-problems/7018/5 "2002-10-24T12:11:34Z")

</div>

hmmm thanx… glad u sorted it. The thing is, Im loading my external .swf files into a traget movie clip, wheras you are using levels.

My code therefore looks like:

Main movie code:

\_root.contents.loadMovie(“welcome.swf”);

(simple preloader on external swf)

total = getBytesTotal();  
loaded = getBytesLoaded();  
if (loaded\>=total) {  
gotoAndPlay(41)  
}

---

<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: [October 24, 2002, 8:32pm UTC](https://forum.kirupa.com/t/preloading-external-swf-problems/7018/6 "2002-10-24T20:32:09Z")

</div>

I initially planned the site the way you are doing it. I haven’t found a way to get the preloader to work using the target method. If you happen to find a solution please let me know.
