471,088 Members | 1,298 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

How to dynamically change a flash movie?

Hi all,

I want to dynamically change a flash movie in an html page. Following
code is working fine in IE, but netscape 4 and 6 it is not working.
Can any one rectify the error:

<HTML>
<HEAD>
<script>
function changeFlash(url){
var d=document;
(d.all)? d.all("flashMov1").movie = url :
d.embeds["flashMov2"].src = url;
}
</script>
</HEAD>

<BODY>
<object id=flashMov1
classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="200" height="150">
<param name="movie" value="f1.swf">
<param name="quality" value="high">

<EMBED name=flashMov2 src="f1.swf" quality=high
WIDTH="200" HEIGHT="150"
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
</EMBED>
</object>
<p></p>
<p><a href="javascript: changeFlash('f1.swf')">One </a></p>
<p><a href="javascript: changeFlash('f2.swf')">Two</a></p>
<p><a href="javascript: changeFlash('f3.swf')">Three</a></p>
(from http://www.thescripts.com/forum/thread92820.html)

I am facing the above same problem!

Can somebody help?

Thanks in advance!
Feb 16 '07 #1
2 10467
acoder
16,027 Expert Mod 8TB
Don't use document.all to detect IE. Give the object an id and use:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById(id).src=url;
and in IE, use the movie parameter to change the source (as you are already doing).
Feb 16 '07 #2
acoder
16,027 Expert Mod 8TB
What you use depends on whether you use OBJECT or EMBED for your flash player. See this link for all the options.

Also, you might consider using SWFObject for detect and embed your Flash Player.
Feb 16 '07 #3

Post your reply

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

Similar topics

3 posts views Thread by btopenworld | last post: by
2 posts views Thread by kiran | last post: by
3 posts views Thread by VMI | last post: by
18 posts views Thread by gconrads | last post: by
reply views Thread by CptDondo | last post: by
2 posts views Thread by vimal.424 | last post: by

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.