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?
17 2864 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
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 -
<html>
-
<body>
-
-
<script type="text/javascript">
-
var int=self.setInterval("clock()",2000);
-
function clock()
-
{
-
i=document.getElementById("order").value
-
if (i=='1') text='This';
-
else if (i=='2') text='is';
-
else if (i=='3') text='a';
-
else if (i=='4') text='message';
-
if (i<4) i++;
-
else i=1;
-
-
document.getElementById("order").value=i
-
document.getElementById("clock").innerHTML=text
-
return i;
-
}
-
</script>
-
<h1 id='clock'>Hi to all</h1>
-
<input type='hidden' id='order' value='1'>
-
-
-
</body>
-
gits 5,390
Expert Mod 4TB
how did you basicly include the flash in your html?
For any JavaScript-Flash integration, I would recommend swfobject.
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 -
<script type="text/javascript">
-
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
-
</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">
-
<param name="movie" value="swf/logo.swf">
-
<param name="quality" value="high">
-
<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>
-
</object>
-
</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
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 - var node = document.getElementById('your_id');
and then set the src: - node.src = 'new_swf_src.swf';
kind regards
Don't I need to chance also the src in the AC_FL_RunContent (last parameter)?
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 ...
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?
Can you post exactly what you tried?
have this which works fine -
<html>
-
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
-
<body>
-
-
<script type="text/javascript">
-
var int=self.setInterval("clock()",2000);
-
function clock()
-
{
-
i=document.getElementById("order").value
-
if (i=='1') text='This';
-
else if (i=='2') text="mike";
-
else if (i=='3') text='a';
-
else if (i=='4') text='message';
-
if (i<4) i++;
-
else i=1;
-
-
document.getElementById("order").value=i
-
document.getElementById("clock").innerHTML=text
-
return i;
-
}
-
</script>
-
<h1 id='clock'>Hi to all
-
<script type="text/javascript">
-
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");
-
</script>
-
</h1>
-
<input type='hidden' id='order' value='1'>
-
</body>
-
</html>
-
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
Instead of trying to insert JavaScript code, make the call to the AC_FL.. function within the function.
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) ?
tried this but after the 1st swf the page loads forever and donot load 2nd swf -
<html>
-
<head>
-
</head>
-
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
-
<body>
-
-
<script type="text/javascript">
-
var int=self.setInterval("clock()",2000);
-
function clock()
-
{
-
i=document.getElementById("order").value
-
if (i=='1')
-
{
-
width='779';
-
height='136';
-
src='gmlogoA';
-
}
-
else if (i=='2')
-
{
-
width='779';
-
height='136';
-
src='gmlogob';
-
}
-
if (i<3) i++;
-
else i=1;
-
-
document.getElementById("order").value=i
-
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' );
-
-
-
return i;
-
}
-
</script>
-
<span id='clock'>Hi to all
-
-
</span>
-
<form>
-
<input type='hidden' id='order' name='order' value='1' />
-
</form>
-
-
</body>
-
</html>
-
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.
Are you refering to some particular documentation/tutorials here in this forum (never noticed that you had any)?
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).
Sign in to post your reply or Sign up for a free account.
Similar topics
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:...
|
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...
|
by: Yash |
last post by:
How can we change the default icon installed through setup on the
desktop and in the start menu.
Thanks.
|
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...
|
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...
|
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...
|
by: sheshusankhya |
last post by:
I want to change flah icon is it possible
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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
|
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...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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...
|
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...
| |