PDA

View Full Version : Rotating Banner Adds



NJusticeForAll2
June 6th, 2003, 05:53 PM
How do I create an fla that rotates banners made in flash (external flash animations) upon refresh on the browser?

mlk
June 7th, 2003, 11:39 AM
you'd probably have to do that with javascript, and tell the browser to load a different swf each time...

Clown Staples
June 7th, 2003, 12:17 PM
loadMovieNum("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.

NJusticeForAll2
June 9th, 2003, 10:11 AM
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

NJusticeForAll2
June 9th, 2003, 10:12 AM
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

Clown Staples
June 9th, 2003, 11:43 AM
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