By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,247 Members | 1,427 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,247 IT Pros & Developers. It's quick & easy.

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

P: 1
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.  
May 16 '07 #1
Share this Question
Share on Google+
3 Replies


Motoma
Expert 2.5K+
P: 3,235
This is more of a Javascript related issue than a Flash issue, so I have passed it along to the appropriate forum.
May 16 '07 #2

Motoma
Expert 2.5K+
P: 3,235
Any reason why you could not do this in Flash? Just create a container movie clip which randomly loads up one of three files.
May 16 '07 #3

kestrel
Expert 100+
P: 1,071
that actually sounds like a better option, why hassle with all the javascript?
May 17 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.