# Preloader code?!

**URL:** <https://forum.kirupa.com/t/preloader-code/120740>\
**Category:** Uncategorized\
**Created:** [August 27, 2004, 12:54am UTC](https://forum.kirupa.com/t/preloader-code/120740 "2004-08-27T00:54:52Z")\
**Posts on this page:** 1\
**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/120740/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);
 }
}

```
