# Preloader for dynamically loaded swf's help

**URL:** <https://forum.kirupa.com/t/preloader-for-dynamically-loaded-swfs-help/121688>\
**Category:** Uncategorized\
**Created:** [September 5, 2004, 5:59pm UTC](https://forum.kirupa.com/t/preloader-for-dynamically-loaded-swfs-help/121688 "2004-09-05T17:59:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![coche09](https://avatars.discourse-cdn.com/v4/letter/c/2bfe46/32.png) [@coche09](https://forum.kirupa.com/u/coche09)\
**Post date:** [September 5, 2004, 5:59pm UTC](https://forum.kirupa.com/t/preloader-for-dynamically-loaded-swfs-help/121688/1 "2004-09-05T17:59:29Z")

</div>

hi guys  
this is my first time posting here, but man this place has helped a newbie like me a bunch! excellent site.  
heres the problem im having:  
im loading external swf’s into an empty movie clip (called container2) into the main timeline, but the loading bar (the mc is called preload) does not scale at all nor it shows when the bytes loaded are more than 1 (i’ve tested it using the show streaming option when testing the movie).  
the script i wrote _seems_ to be working , cause it traces the total bytes loaded in the output window…  
most of the preloaders / tutorials i’ve seen use 3 keyframes, my main movie is 1 keyframe long, i don’t know if this has anything to do with it.

heres the script:

preload.onEnterFrame = function() {

//setup variables  
var Bload = \_root.container2.getBytesLoaded();  
var Btotal = \_root.container2.getBytesTotal();  
var Bpercentage = Math.round((load/total)\*100);

//tell the preload bar to scale  
\_root.preload.\_xscale = Bpercentage;

//make bar visible / invisible  
if ((Bpercentage == 100) ) {  
delete this.onEnterFrame;  
preload.\_visible=0;  
}else {  
if (Bpercentage \>= 1){  
preload.\_visible=100;  
}  
}

trace (Bload);  
};  
stop ();

sorry for the super long post and thanks in advance!  
coche
