# Loading random swfs that have a preloader

**URL:** <https://forum.kirupa.com/t/loading-random-swfs-that-have-a-preloader/92463>\
**Category:** Uncategorized\
**Created:** [October 17, 2003, 2:22pm UTC](https://forum.kirupa.com/t/loading-random-swfs-that-have-a-preloader/92463 "2003-10-17T14:22:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grub](https://avatars.discourse-cdn.com/v4/letter/g/51bf81/32.png) [@Grub](https://forum.kirupa.com/u/Grub)\
**Post date:** [October 17, 2003, 2:22pm UTC](https://forum.kirupa.com/t/loading-random-swfs-that-have-a-preloader/92463/1 "2003-10-17T14:22:48Z")

</div>

Hi

I have my main movie and when arriving at certain frames I want to load a random .swf

I am using this

[AS]loadMovieNum(“random”+(Math.ceil(Math.random()\*5))+".swf", 1);[/AS]

which works fine

but when i add a preloader to the external movie the main movie wont open it

the preloader code is this:

var loadAmount = \_totalframes;

if (\_framesloaded == loadAmount) {

gotoAndPlay(“build”, 1);

} else {

loaded = Math.round(getBytesLoaded() / 1024);  
total = Math.round(getBytesTotal() / 1024);  
percent = Math.round((loaded/total) \* 100);

bytesLoadedOutput = loaded;  
bytesTotalOutput = total;  
percentOutput = percent + “%”;

loadBar.\_width = loadBarHousing.\_width \* (percent / 100);

gotoAndPlay(“loading”);  
}

I’m stumped :sigh:

any ideas??

thanks very much
