PDA

View Full Version : Multiple SWFObjects when loading HTML into PHP


lorrie
10-16-2008, 03:22 PM
I'm attempting to load alternative content into a site page. I'm loading HTML content into PHP via include files. I've got the SWFObject.js file included and added into the html content pages. I'm loading all my content using the static method.

If I have only 1 SWFObject used, the alternative content shows up just fine. Once I add multiple SWFObjects into the page, it only shows my Flash content (even with Javascript disabled in Firefox 3.0.3 on Mac).

Some of my alternative content is a single image, others are multiple images (a header navigation panel).

In one page, I have:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>

<script type="text/javascript" src="../js/swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("swfContent1", "8.0.0", "../swf/expressInstall.swf");
</script>
<script type="text/javascript">
swfobject.registerObject("swfContent2", "8.0.0", "../swf/expressInstall.swf");
</script>
<script type="text/javascript">
swfobject.registerObject("swfContent3", "8.0.0", "../swf/expressInstall.swf");
</script>

</head>
<body>

...Regular HTML...

<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="201" height="235" id="swfContent1">
<param name="movie" value="../swf/mySwf1.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="../swf/mySwf1.swf" width="201" height="235">
<!--<![endif]-->

<img src="../images/alternativeImage1.jpg" />

<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>

<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="201" height="235" id="swfContent2">
<param name="movie" value="../swf/mySwf2.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="../swf/mySwf2.swf" width="201" height="235">
<!--<![endif]-->

<img src="../images/alternativeImage2.jpg" />

<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>

<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="201" height="235" id="swfContent3">
<param name="movie" value="../swf/mySwf3.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="../swf/mySwf3.swf" width="201" height="235">
<!--<![endif]-->

<img src="../images/alternativeImage3.jpg" />

<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>

</body>
</html>

I'm not sure if there's a problem with the SWFObject.js file to deal with multiple SWFObjects in the content or if it's a problem with my code. Any help would be appreciated.

lorrie
10-27-2008, 06:34 PM
I guess I was asking my question wrong, I know the SWFObject should work correctly with plain HTML or XHTML, but I don't know as much about the Javascript file itself, whether I have to make any changes to that? I also was not sure if I could load the alternative content (which is an HTML file) as an include file into a PHP file and have the SWFObject still work, but that's probably best asked in the PHP/Server-side forum.

Thanks anyways