# Random BG Imges Like Nike Site

**URL:** <https://forum.kirupa.com/t/random-bg-imges-like-nike-site/20429>\
**Category:** flash\
**Created:** [May 8, 2003, 3:49pm UTC](https://forum.kirupa.com/t/random-bg-imges-like-nike-site/20429 "2003-05-08T15:49:12Z")\
**Posts on this page:** 8\
**Page:** 1

<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:** [May 8, 2003, 3:49pm UTC](https://forum.kirupa.com/t/random-bg-imges-like-nike-site/20429/1 "2003-05-08T15:49:12Z")

</div>

I am desinging my new site and I really would like to have my backgroudn images change in flsadh every time the user refreshes the page. A great example is nike’s site.

[http://www.nike.com/usa/index.html](http://www.nike.com/usa/index.html)

Any 1 have a clue? Cuz I dont

Thanks

---

<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:** [May 8, 2003, 3:53pm UTC](https://forum.kirupa.com/t/random-bg-imges-like-nike-site/20429/2 "2003-05-08T15:53:17Z")

</div>

you could have the .jpg’s in an array… 🙂

```auto
var imgs = ["image1.jpg", "image2.jpg", "etc", "etc"];
someMovieClip.loadMovie(imgs[Math.floor(Math.random()*imgs.length)]);

```

---

<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:** [May 8, 2003, 3:54pm UTC](https://forum.kirupa.com/t/random-bg-imges-like-nike-site/20429/3 "2003-05-08T15:54:04Z")

</div>

Try this…

[http://www.kirupa.com/developer/mx/loadingrandombackground.htm](http://www.kirupa.com/developer/mx/loadingrandombackground.htm)

TD

---

<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:** [May 8, 2003, 3:55pm UTC](https://forum.kirupa.com/t/random-bg-imges-like-nike-site/20429/4 "2003-05-08T15:55:32Z")

</div>

😛

there’s a tutorial here at kirupa!! i didn’t know that. =)

---

<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:** [May 8, 2003, 4:36pm UTC](https://forum.kirupa.com/t/random-bg-imges-like-nike-site/20429/5 "2003-05-08T16:36:54Z")

</div>

thanks guys, i love this forum someone is always so willing to help:)

---

<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:** [May 8, 2003, 4:37pm UTC](https://forum.kirupa.com/t/random-bg-imges-like-nike-site/20429/6 "2003-05-08T16:37:57Z")

</div>

yeah… i love it too. :love: 😛

---

<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:** [May 8, 2003, 4:48pm UTC](https://forum.kirupa.com/t/random-bg-imges-like-nike-site/20429/7 "2003-05-08T16:48:06Z")

</div>

omg TobyDog that tut was great. I recommend it to every1. and it was really really simple. i cant believe its that easy…

---

<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:** [May 8, 2003, 7:16pm UTC](https://forum.kirupa.com/t/random-bg-imges-like-nike-site/20429/8 "2003-05-08T19:16:26Z")

</div>

I just checked that tute, and it’s slightly wrong.

there’s a line somewhere that says  
[AS] choice = math.round(math.random()\*5)[/AS]

that should be changed to:

[AS] choice = math.floor(math.random()\*6)[/AS]

Senocular says why [here](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=11686&highlight=math.round).
