Change flash files on screen by pressing a button
I am trying to work out a way to change the flash file displayed on the screen to another file by clicking a button. I was able to do it with images jpg
, but I cannot get it to work with files flash
. Can anyone please help? I would be very grateful.
Below are two htmls:
- The first one changes the
jpg
images and it works - The second one, which I designed to do the same with files
flash
, but it doesn't work.
I had to put //
on all lines, otherwise when I posted the question it was trying to execute the html. Thank.
Html 1. This changes image 1 to image 2 on click. he 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 for changing Flash 1 to Flash 2 on click. He 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>
source to share
I have the same problem. However, I made this work on IE, but it still doesn't work in Firefox.
Code that works in IE:
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 in IE, choose the one you like.