jijesh Aj
jijesh Aj

Reputation: 614

Dynamic swf file change on button click

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"    "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript">
var flashNumber = 0;
var items = 3;
films = new Array(items)
films[0] = "1.swf";
films[1] = "2.swf";
films[2] = "0.swf";
function rotate(){
holder = document.getElementById('content');
flashNumber++;
if(flashNumber == items)
    flashNumber = 0;
holder.src = films[flashNumber];
}
</script>
</head>
<body>
<object width="400" height="300">
<param name="movie" value="1.swf">
<embed src = "movies/animals1.swf" name="content" id="content" 
width="400" height="300">
</embed>
</object>
<input type="button" value="next" onclick="rotate();" />
</body>
</html>

The aboe code playing only one swf file that is inside object tag..while clicking button no other files are not loading...

Upvotes: 0

Views: 541

Answers (1)

rid
rid

Reputation: 63590

You're probably testing this in a browser that uses the <object> tag, which you're not updating in the rotate() function. I suggest you create a container, use something like SWFObject to generate the tag inside the container, then when running rotate(), change the contents of the container.

Upvotes: 1

Related Questions