# Random BG Image Tutorial

**URL:** <https://forum.kirupa.com/t/random-bg-image-tutorial/7808>\
**Category:** flash\
**Created:** [November 8, 2002, 12:48am UTC](https://forum.kirupa.com/t/random-bg-image-tutorial/7808 "2002-11-08T00:48:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![advan](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@advan](https://forum.kirupa.com/u/advan)\
**Post date:** [November 8, 2002, 12:48am UTC](https://forum.kirupa.com/t/random-bg-image-tutorial/7808/1 "2002-11-08T00:48:36Z")

</div>

The tutorial was great!

I came up with one question though.

Why does this work… (using the location.loadMovie)

choice = Math.round(Math.random()\*3);  
switch (choice) {  
case 0 :  
location.loadMovie(“bgphoto0.swf”);  
break;  
case 1 :  
location.loadMovie(“bgphoto1.swf”);  
break;  
case 2 :  
location.loadMovie(“bgphoto2.swf”);  
break;  
}

but when I try using this (location.loadMovieNum) it doesnt’t load.

choice = Math.round(Math.random()\*3);  
switch (choice) {  
case 0 :  
location.loadMovieNum(“bgphoto0.swf”, 1);  
break;  
case 1 :  
location.loadMovieNum(“bgphoto1.swf”, 1);  
break;  
case 2 :  
location.loadMovieNum(“bgphoto2.swf”, 1);  
break;  
}

:)thx

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 8, 2002, 1:01am UTC](https://forum.kirupa.com/t/random-bg-image-tutorial/7808/2 "2002-11-08T01:01:32Z")

</div>

nevermind, i figured it out.

I ditched the variable and positioned the photo on a same size movie screen as my main movie, and made it simply loadMovieNum instead of location.loadMovieblahblahblah

😃
