# Load a random background – and then another

**URL:** <https://forum.kirupa.com/t/load-a-random-background-and-then-another/216778>\
**Category:** Uncategorized\
**Created:** [February 20, 2007, 2:01pm UTC](https://forum.kirupa.com/t/load-a-random-background-and-then-another/216778 "2007-02-20T14:01:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![longneck](https://avatars.discourse-cdn.com/v4/letter/l/9f8e36/32.png) [@longneck](https://forum.kirupa.com/u/longneck)\
**Post date:** [February 20, 2007, 2:01pm UTC](https://forum.kirupa.com/t/load-a-random-background-and-then-another/216778/1 "2007-02-20T14:01:23Z")

</div>

Hi

I’ve followed this tutorial:  
[http://www.kirupa.com/developer/mx/loadingrandombackground.htm](http://www.kirupa.com/developer/mx/loadingrandombackground.htm)

and then looked through the forums to take it to the next level.

The next level beeing this; When the parent movie has loaded a random swf I want it to load another swf after – say 5 seconds – and then again after another 5 seconds…

How do I achieve that?

Here’s the code that I’m using btw:

\*_choice = Math.round(Math.random()5);  
switch (choice) {  
case 0 :  
location.loadMovie(“image0.swf”);  
break;  
case 1 :  
location.loadMovie(“image1.swf”);  
break;  
case 2 :  
location.loadMovie(“image2.swf”);  
break;  
case 3 :  
location.loadMovie(“image3.swf”);  
break;  
case 4 :  
location.loadMovie(“image4.swf”);  
break;  
case 5 :  
location.loadMovie(“image5.swf”);  
break;  
}_

Any ideas would be highly appreciated…
