Connecting Tech Pros Worldwide Forums | Help | Site Map

Make different swf files appear on a website when you refresh it

Newbie
 
Join Date: May 2007
Posts: 1
#1: May 16 '07
Hi

I am trying to make a html page where I have 3 swf files which I would to be shown randomly when you refresh the page.

However I can't get the code to work. I have tried to delete the javascript part and then the movies are being shown - but not in the right way. And when the javascript is there no movies are shown.

I would really appreciate if someone could help me!

Thanks!

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>Untitled Document</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. </head>
  6.  
  7. </body>
  8.  
  9. <script language="JavaScript">
  10.  
  11. // Generate a Random Number
  12. var randomnumber = Math.round(Math.random()*3);
  13.  
  14. // Select a movie and execute the corresponding function
  15. if (randomnumber == 1)
  16.  
  17. {movie1();}
  18.  
  19. else if (randomnumber == 2)
  20.  
  21. {movie2();}
  22.  
  23. else {movie3();}
  24.  
  25. // Functions to write out the correct flash movie resource.
  26.  
  27. function movie1(){
  28. document.write("<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="600" height="233">
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.     <param name="movie" value="http://www.wiseentertainment.dk/quizformoney/Interstitials/lobby.swf" />
  37.     <param name="quality" value="high" />
  38.     <embed src="http://www.wiseentertainment.dk/quizformoney/Interstitials/lobby.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="600" height="233"></embed>
  39.   </object>")
  40. }
  41.  
  42. function movie2(){
  43. document.write("<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="600" height="233">
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.     <param name="movie" value="http://www.wiseentertainment.dk/quizformoney/Interstitials/deposit.swf" />
  52.     <param name="quality" value="high" />
  53.     <embed src="http://www.wiseentertainment.dk/quizformoney/Interstitials/deposit.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="600" height="233"></embed>
  54.   </object>")
  55. }
  56.  
  57. function movie3(){
  58. document.write("<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="600" height="233">
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.     <param name="movie" value="http://www.wiseentertainment.dk/quizformoney/Interstitials/lobby.swf" />
  67.     <param name="quality" value="high" />
  68.     <embed src="http://www.wiseentertainment.dk/quizformoney/Interstitials/lobby.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="600" height="233"></embed>
  69.   </object>")
  70. }
  71.  
  72. </script>
  73.  
  74. </html>
  75.  

Motoma's Avatar
Moderator
 
Join Date: Jan 2007
Location: Maine, USA
Posts: 2,904
#2: May 16 '07

re: Make different swf files appear on a website when you refresh it


This is more of a Javascript related issue than a Flash issue, so I have passed it along to the appropriate forum.
Motoma's Avatar
Moderator
 
Join Date: Jan 2007
Location: Maine, USA
Posts: 2,904
#3: May 16 '07

re: Make different swf files appear on a website when you refresh it


Any reason why you could not do this in Flash? Just create a container movie clip which randomly loads up one of three files.
kestrel's Avatar
Moderator
 
Join Date: Jul 2006
Location: California!!!
Posts: 898
#4: May 17 '07

re: Make different swf files appear on a website when you refresh it


that actually sounds like a better option, why hassle with all the javascript?
Reply