473,405 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

how can I periodically change the flash shown?

mikek12004
200 100+
Most of you must have seen a flash which after a period of time is replaced by another flash, which in turn is replaced by another flash etc. how to this?
Mar 11 '09 #1
17 2865
gits
5,390 Expert Mod 4TB
you may use JavaScripts setInterval() method to call a function that periodically changes the src/value for the respective embed/object tags to new values ...

kind regards
Mar 11 '09 #2
mikek12004
200 100+
OK this is the code which works fine replacing text in a div; how it can be mod to replace flash?tried to put into the text variable what I would put in the HTML to display the flash but didn't work
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3.  
  4. <script type="text/javascript">
  5. var int=self.setInterval("clock()",2000);
  6. function clock()
  7. {
  8. i=document.getElementById("order").value
  9. if (i=='1') text='This';
  10. else if (i=='2') text='is';
  11. else if (i=='3') text='a';
  12. else if (i=='4') text='message';
  13. if (i<4) i++;
  14. else i=1;
  15.  
  16. document.getElementById("order").value=i
  17. document.getElementById("clock").innerHTML=text
  18. return i;
  19. }
  20. </script>
  21. <h1 id='clock'>Hi to all</h1>
  22. <input type='hidden' id='order' value='1'>
  23.  
  24.  
  25. </body>
  26.  
Mar 11 '09 #3
gits
5,390 Expert Mod 4TB
how did you basicly include the flash in your html?
Mar 11 '09 #4
acoder
16,027 Expert Mod 8TB
For any JavaScript-Flash integration, I would recommend swfobject.
Mar 11 '09 #5
mikek12004
200 100+
I use the standard code produced by dreamweaver. In the place you wish the flash to appear choose (Insert->media->flash) and he program produce the following code
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','468','height','60','src','swf/logo','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','swf/logo' ); //end AC code
  3. </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="468" height="60">
  4.   <param name="movie" value="swf/logo.swf">
  5.   <param name="quality" value="high">
  6.   <embed src="swf/logo.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="468" height="60"></embed>
  7. </object>
  8. </noscript>
As I have seen the AC_FL_RunContent function alone do the work just fine the noscript tag exists for older browsers who do not support the above function
Mar 12 '09 #6
gits
5,390 Expert Mod 4TB
in this case you need to retrieve the first param-node and the embed-node and change its src-attribute ... give them different id-attribs and retrieve them with

Expand|Select|Wrap|Line Numbers
  1. var node = document.getElementById('your_id');
and then set the src:

Expand|Select|Wrap|Line Numbers
  1. node.src = 'new_swf_src.swf';
kind regards
Mar 12 '09 #7
mikek12004
200 100+
Don't I need to chance also the src in the AC_FL_RunContent (last parameter)?
Mar 12 '09 #8
gits
5,390 Expert Mod 4TB
ahh ... i just overlooked that ... of course ... but then you just need to call the method with the other parameter again ...
Mar 12 '09 #9
mikek12004
200 100+
well tried that and the default banner changes ok but then the 2nd one do not and the page loads forever hmm....do you know if something like this already exists or how to search for it?
Mar 17 '09 #10
acoder
16,027 Expert Mod 8TB
Can you post exactly what you tried?
Mar 17 '09 #11
mikek12004
200 100+
have this which works fine
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
  3. <body>
  4.  
  5. <script type="text/javascript">
  6. var int=self.setInterval("clock()",2000);
  7. function clock()
  8. {
  9. i=document.getElementById("order").value
  10. if (i=='1') text='This';
  11. else if (i=='2') text="mike";
  12. else if (i=='3') text='a';
  13. else if (i=='4') text='message';
  14. if (i<4) i++;
  15. else i=1;
  16.  
  17. document.getElementById("order").value=i
  18. document.getElementById("clock").innerHTML=text
  19. return i;
  20. }
  21. </script>
  22. <h1 id='clock'>Hi to all
  23.   <script type="text/javascript">
  24. AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','779','height','136','src','gmlogoA','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','gmlogoA' ); //end AC code");
  25. </script>
  26. </h1>
  27. <input type='hidden' id='order' value='1'>
  28. </body>
  29. </html>
  30.  
problem is that I want instead of letters which are in the text variable of the clock() to put a flash like I did manually in <h1>, tried to put it in the text but finds the ending script tag and ignores rest of javascript any help
May 4 '09 #12
acoder
16,027 Expert Mod 8TB
Instead of trying to insert JavaScript code, make the call to the AC_FL.. function within the function.
May 4 '09 #13
mikek12004
200 100+
how exactly can I call the AC_FL.. function and have the flash to appear inside the h1 tag (or any other area I put e.g with a span) ?
May 5 '09 #14
mikek12004
200 100+
tried this but after the 1st swf the page loads forever and donot load 2nd swf
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. </head>
  4. <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
  5. <body>
  6.  
  7. <script type="text/javascript">
  8. var int=self.setInterval("clock()",2000);
  9. function clock()
  10. {
  11. i=document.getElementById("order").value
  12. if (i=='1') 
  13. {
  14.     width='779';
  15.     height='136';
  16.     src='gmlogoA';
  17. }
  18. else if (i=='2') 
  19. {
  20.     width='779';
  21.     height='136';
  22.     src='gmlogob';
  23. }
  24. if (i<3) i++;
  25. else i=1;
  26.  
  27. document.getElementById("order").value=i
  28. document.getElementById("clock").innerHTML=AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','779','height','136','src','gmlogoA','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','gmlogoA' ); 
  29.  
  30.  
  31. return i;
  32. }
  33. </script>
  34. <span id='clock'>Hi to all
  35.  
  36. </span>
  37. <form>
  38. <input type='hidden' id='order'  name='order' value='1' />
  39. </form>
  40.  
  41. </body>
  42. </html>
  43.  
May 5 '09 #15
acoder
16,027 Expert Mod 8TB
I would recommend, as I have done earlier, that you go with swfobject. It should be more reliable and easier to work with than the AC_FL code. Also check out the tutorials/documentation.
May 5 '09 #16
mikek12004
200 100+
Are you refering to some particular documentation/tutorials here in this forum (never noticed that you had any)?
May 5 '09 #17
acoder
16,027 Expert Mod 8TB
No, I meant in the swfobject link (Getting Started). There are some tutorials/articles in the insights section, but not for what you want (currently anyway).
May 5 '09 #18

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

Similar topics

6
by: Gustav Medler | last post by:
Hello, there is a known problem with Opera and the execution of content shown in <NOSCRIPT> tag. Everythings works fine, if there is only one simple script like:...
1
by: Bruce W.1 | last post by:
I want to put a live connection in a web page to periodically updated data. When the data changes, the server notifys the client and gives the new data. The client does not regularly refresh the...
2
by: Yash | last post by:
How can we change the default icon installed through setup on the desktop and in the start menu. Thanks.
8
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web...
0
by: =?Utf-8?B?QnJpYW5ESA==?= | last post by:
Hi I am trying to find a way to change the background color of a cell (flash or blink) when its value has changed (by user or data update). I need to be able to do this for more than one cell...
0
by: =?Utf-8?B?QnJpYW5ESA==?= | last post by:
Hi I am trying to find a way to change the background color of a cell (flash or blink) when its value has changed (by user or data update). I need to be able to do this for more than one cell...
1
by: sheshusankhya | last post by:
I want to change flah icon is it possible
3
by: GloStix | last post by:
What I have now is a static banner that loads as an background-image via css stylesheet but I put on top of that a flash banner so it would load the static banner and the flash will fade in. The...
0
by: stylishjm | last post by:
I have tried asking for help on multiple forums including VB with no responses. Anyway my problem is that Im attempting to create a simple music file hosting website using vBulletin 4 with the use...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.