# Rotating Banner Adds

**URL:** <https://forum.kirupa.com/t/rotating-banner-adds/22670>\
**Category:** flash\
**Created:** [June 6, 2003, 9:53pm UTC](https://forum.kirupa.com/t/rotating-banner-adds/22670 "2003-06-06T21:53:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![NJusticeForAll2](https://avatars.discourse-cdn.com/v4/letter/n/e19adc/32.png) [@NJusticeForAll2](https://forum.kirupa.com/u/NJusticeForAll2)\
**Post date:** [June 6, 2003, 9:53pm UTC](https://forum.kirupa.com/t/rotating-banner-adds/22670/1 "2003-06-06T21:53:01Z")

</div>

How do I create an fla that rotates banners made in flash (external flash animations) upon refresh on the browser?

---

<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:** [June 7, 2003, 3:39pm UTC](https://forum.kirupa.com/t/rotating-banner-adds/22670/2 "2003-06-07T15:39:46Z")

</div>

you’d probably have to do that with javascript, and tell the browser to load a different swf each time…

---

<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:** [June 7, 2003, 4:17pm UTC](https://forum.kirupa.com/t/rotating-banner-adds/22670/3 "2003-06-07T16:17:35Z")

</div>

loadMovieNum(“[http://something](http://something)”,0)  
this says to replace \_level0 which is the current swf, with a new movie, so

urlArray = [“http://…firstbanner.swf”,  
“http://…secondbanner.swf”,  
“http://…thirdbanner.swf”,…];

loadMovieNum( urlArray[Math.random(urlArray.length)],0);

this will replace the current movie with a random swf from the list.

---

<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:** [June 9, 2003, 2:11pm UTC](https://forum.kirupa.com/t/rotating-banner-adds/22670/4 "2003-06-09T14:11:29Z")

</div>

Ok. So that replaces the last banner, but how do I go about replacing it randomly every time you refresh? Like… onLoad some random function picks some random URL from a list?

Thank you;

Nathalia

---

<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:** [June 9, 2003, 2:12pm UTC](https://forum.kirupa.com/t/rotating-banner-adds/22670/5 "2003-06-09T14:12:23Z")

</div>

I actualy don’t really even understand how to use the random function in Flash. Could someone explain that function for me?

Thank you;

Nathalia

---

<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:** [June 9, 2003, 3:43pm UTC](https://forum.kirupa.com/t/rotating-banner-adds/22670/6 "2003-06-09T15:43:44Z")

</div>

that should do it i think, because when you refresh it sould reload the movie with that code in it…  
which would cause a new random number to be selected and a different movie to be loaded

random() = random number between 0 and 1  
random()\*100 =random number between 0 and 100  
random()\*n =random number between 0 and n  
random()\*100-50 =random number between -50 and 50

random(100) = random integer between 0 and 100 , you wont get 23.4 or anything like that  
random(n) = random integer between 0 and n  
random(myArray.length) = random number of a member of the array

myArray[random(myArray.length)] = a random entry from the array

thats some random basics

im 65 % sure everything i just told you is off by 1 but you can check
