PDA

View Full Version : displaying 3 random flash movies



d_reaper86
08-19-2008, 09:21 AM
Hey guys,

I'm stuck!
I have to write or find a bit of code that can display random flash movies when the page is refreshed, i found loads that work but, i need it to work so that 3 different flash movies are displayed at the same time and they all change on refresh but never two of the same appear.

I have currently written it so that it is 3 different codes for each one and only put certain flash movies into each ie;(flash1.swf and flash2.swf) are in one code and (flash3.swf and flash4.swf) are in the second etc.

But the customer is not happy with this, he wants it so that all three display all the random flash movies and not just set into each one.

Hope someone can figure out what im saying and help me!

Thank youu

Nile
08-19-2008, 03:24 PM
Here's a script I made awhile ago, change the highlighted to your three movies. Tell me if anythings wrong, like if you want all three of them random? I can do that. Just tell me. Heres the random code(again, change the highlighted):

<script type="text/javascript">
// Generate a Random Number
var movieDis; //global variable
var number = 2; //your number of videos -1
var randomnumber = Math.round(Math.random()*number+1); //generate a random number between 1-number+1
movie(randomnumber);

//Functions to write out the correct flash movie resource.
function movie(num){
if(num == 1){
movieDis = "Movie1";
} else if(num == 2){
movieDis = "Movie2";
}else if(num == 3){
movieDis = "Movie3";
} else {
movieDis = "There was an error. Please try again."; //error
}
document.write(movieDis);
}
</script>

d_reaper86
08-22-2008, 10:50 AM
here the link to what i have so far
www.pcoleconsult.co.uk - you see on the right hand side there are 3 flash files that change on page refresh, but its not completly random all round, they are 3 seperate random scripts that each display 2 different files each.

I would like it so that they are all linked together and they all display all the different files.

ie. the first project can display all 7 projects and so can the second and third but no same project appears at the same time.

hope this makes sense!!!

scrupter
09-16-2008, 07:37 PM
Hi..

I've got a selection of flash files that I would like to play in random - when people enter a site... (i.e. a teaser for each brand of products, when opening the site the intro should display a teaser from one of many brands/swf movies...)

SWF files made in: SWiSH Max.

Can't get the coding right, and if anyone could help I'd be very greatful.. :)

The code listed above has given me the most luck (shows file names in random - but not the actual files..) so far I've got three options, to view each, replace the last number in the link with 2 or 3... www.tennishuset.no/1.html

Thanks...!