Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Go Back   Code Forums > Application and Web Development > HTML, XML, Javascript, AJAX
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
Old 05-18-2005, 11:12 AM   #1 (permalink)
VisionsIC
Registered User
 
Join Date: May 2005
Posts: 1
VisionsIC is on a distinguished road
Exclamation Rotating .swf files at random with JavaScript?

Hi All,

Maybe someone can point out what I have done wrong here? I'm trying to get JavaScript & HTML to rotate my Flash .swf files at random. I successfully had it working with image files, but can't seem to get it to function with my .swf files because flash .swf files are controlled by an object tag in HTML. How would I get this to work?

Here is the page in question:

http://www.visionsic.com/sm_randomimage.htm

And here is the suspect Javascript & HTML code:

HEAD Tag Code
Code:
<SCRIPT LANGUAGE="JavaScript"> <!-- Begin var interval = 20.0; // delay between rotating images (in seconds) var random_display = 1; // 0 = no, 1 = yes interval *= 1000; var object_index = 0; object_list = new Array(); object_list[object_index++] = new objectItem("/services/pics/r_pic01.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic02.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic03.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic04.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic05.swf"); object_list[object_index++] = new ObjectItem("/services/pics/r_pic06.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic07.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic08.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic09.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic10.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic11.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic12.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic13.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic14.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic15.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic16.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic17.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic18.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic19.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic20.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic21.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic22.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic23.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic24.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic25.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic26.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic27.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic28.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic29.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic30.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic31.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic32.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic33.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic34.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic35.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic36.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic37.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic38.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic39.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic40.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic41.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic42.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic43.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic44.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic45.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic46.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic47.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic48.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic49.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic50.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic51.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic52.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic53.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic54.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic55.swf"); object_list[object_index++] = new objectItem("/services/pics/r_pic56.swf"); var number_of_object = object_list.length; function objectItem(object_location) { this.object_item = new Object(); this.object_item.src = object_location; } function get_ObjectItemLocation(objectObj) { return(objectObj.object_item.src) } function generate(x, y) { var range = y - x + 1; return Math.floor(Math.random() * range) + x; } function getNextObject() { if (random_display) { object_index = generate(0, number_of_object-1); } else { object_index = (object_index+1) % number_of_object; } var new_object = get_ObjectItemLocation(object_list[object_index]); return(new_object); } function rotateObject(place) { var new_image = getNextObject(); document[place].src = new_object; var recur_call = "rotateObject('"+place+"')"; setTimeout(recur_call, interval); } // End --> </script>
BODY Tag Code
Code:
<body OnLoad="rotateObject('rObject')"> <div align="right"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" name="rObject" width="165" height="135" id="rObject"> <param name="movie" value="services/pics/r_pic01.swf"> <param name="quality" value="high"> <embed src="services/pics/r_pic01.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="165" height="135"></embed> </object> </div> </body>
Now, is the problem caused by a error in the BODY HTML code, or the JavaScript code in the HTML HEAD tag?

If anyone knows my mistake, and can help, it'd greatly be appreciated!

Thanks,

Aaron
__________________
VisionsIC is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Temp Internet Files - Delete wendyng HTML, XML, Javascript, AJAX 0 04-18-2005 10:30 PM
Installing and using CMUgraphics library. Valmont Standard C, C++ 12 03-29-2003 08:39 AM
Javascriptin' like there ain't no tomorrow saline Saline's Brain Teasers 7 03-12-2003 01:17 AM


All times are GMT -8. The time now is 05:39 PM.


Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2006, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
Open Circle