...

View Full Version : swfobject multiple movies on page..



earth2mac
04-25-2009, 04:54 PM
Below is the code i generated. What if I have multiple flash movies on page? Do i use same script, and if so, do i need another id or need to make other modifications for other movies on page?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("myFlashContent", "9.0.0");
</script>
</head>
<body>
<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="600" id="myFlashContent">
<param name="movie" value="MainMovie.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="MainMovie.swf" width="800" height="600">
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</body>
</html>

abduraooft
04-25-2009, 05:18 PM
do i need another id or need to make other modifications for other movies on page?
Yes, make another element with a different id(say myFlashContent1,myFlashContent2 etc, since you can't use the same id for multiple elements inside a document), and then include the function calls like

<script type="text/javascript">
swfobject.registerObject("myFlashContent1", "9.0.0");
swfobject.registerObject("myFlashContent2", "9.0.0");
swfobject.registerObject("myFlashContent3", "9.0.0");
</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum