tags:

views:

277

answers:

2

I am trying to develop a way to change a flash file displayed on the screen to another file by clicking a button. I have been able to do this with jpg images, but I can't get it to work with flash files. Can anyone help? I would greatly appreciate it. Below are two html's: the first one changes jpg images and it works, the second one I constructed to be similar to do the same with flash files but it does not work. I had to put // on all the lines, otherwise when I submitted the question it was tring to execute the html's. Thanks.

//Html 1. This changes Image 1 to Image 2 on click. It works
<html>
<head>
<script type="text/javascript">
function changeSrc()
{
document.getElementById("myImage").src="Image 2.jpg";
}
</script>
</head>
<body>
<img id="myImage" src="Image 1.jpg" width="400" height="400" />
<br /><br />
<input type="button" onclick="changeSrc()" value="Change image">
</body>
</html>
//
//
//Html 2. This is intended to change Flash 1 to Flash 2 on click. It does not work
<html>
<head>
<script type="text/javascript">
function changeSrc()
{
document.getElementById("myImage").src="Flash 2.swf";
}
</script>
</head>
<body>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 
id="myImage" width="450" height="335"> 
<param name="movie"  value="Flash 1.swf" /> 
</object> 
<br /><br />
<input type="button" onclick="changeSrc()" value="Change image">
</body>
</html>
A: 

This is a duplicate question. Looks like the other one has a couple answers already so this one should probably be closed.

http://stackoverflow.com/questions/337505/changing-a-flash-file

Herms
A: 

I'm having the same problem. However, I made this work on IE but it is still not working in Firefox. The codes that works in IE are:

document.getElementById('Flash1').movie = 'flash2.swf';

document.Flash1.movie = "flash2.swf";

document.getElementById('Flash1').LoadMovie(0, 'flash2.swf');

document.getElementsByName("Flash1")[0].movie = 'flash2.swf';

Any code will work on IE, select the one you like. Please let me know if you have found the correct code that works in both IE and Firefox, my email es nico25lp (at) yahoo.com Regards, Fab