I have a simple <embed>
tag for my flash animation in Chrome, and I want to swap out the animation dynamically:
<embed id="test" src="init.swf" width="550" height="400"> </embed>
<script>
setTimeout(function() {
document.getElementById("test").src = "test.swf";
console.log("Swapped");
}, 5000);
</script>
I expected init.swf
to play for five seconds, before switching over to test.swf
.
Instead, it keeps playing init.swf
indefinitely. Meanwhile, the JS console shows Swapped
, so the code is running. Even stranger, the element inspector shows the src
tag updating, but the animation does not change.
Changing the width
from either the inspector or my JS function works as expected, but src
is not updated.
How can I replace this animation with another one?