# Random background swf question

**URL:** https://forum.kirupa.com/t/random-background-swf-question/43837
**Category:** flash
**Created:** [February 26, 2004, 11:01am UTC](https://forum.kirupa.com/t/random-background-swf-question/43837 "2004-02-26T11:01:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Cello](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@Cello](https://forum.kirupa.com/u/Cello)
#### Post date: [February 26, 2004, 11:01am UTC](https://forum.kirupa.com/t/random-background-swf-question/43837/1 "2004-02-26T11:01:06Z")

</div>

Hi all - hope you’re all well 🙂

I have a question regarding the Random Background image/swf tut.

The AS that does the work is this:  
[AS]on (release) {  
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;  
}  
}  
[/AS]

What I’d really like to do is make sure that on pressing F5 in the browser (IE) the next image is not a repeat of the previous randomly selected image.

Any ideas? (Sorry - me and AS still getting acquainted 🙂  
Thx for any help.
