# Preloader code?!

**URL:** <https://forum.kirupa.com/t/preloader-code/62341>\
**Category:** Uncategorized\
**Created:** [August 27, 2004, 12:54am UTC](https://forum.kirupa.com/t/preloader-code/62341 "2004-08-27T00:54:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbrindley](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@mbrindley](https://forum.kirupa.com/u/mbrindley)\
**Post date:** [August 27, 2004, 12:54am UTC](https://forum.kirupa.com/t/preloader-code/62341/1 "2004-08-27T00:54:52Z")

</div>

upon loading a swf, i have this code…which works great…  
what i am trying to do is, for a button on that same swf, have it load and external swf into a target, with the same code in the external swf…

but when i load it…it goes back and loads the previous swf…  
i think i got something wrong with the roots, right???  
help!!!  
thanks

```auto

onClipEvent (load) {
 total = _root.getBytesTotal();
}
onClipEvent (enterFrame) {
 loaded = _root.getBytesLoaded();
 percent = int(loaded/total*100);
 text = percent+"%";
 gotoAndStop(percent);
 if (loaded == total) {
  _root.gotoAndPlay(8);
 }
}

```

---

<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 27, 2004, 2:47am UTC](https://forum.kirupa.com/t/preloader-code/62341/2 "2004-08-27T02:47:39Z")

</div>

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 27, 2004, 2:50am UTC](https://forum.kirupa.com/t/preloader-code/62341/3 "2004-08-27T02:50:31Z")

</div>

> [@pratik](#):
>
> thanks

lol, thanks for what??
