PDA

View Full Version : SWFObject version 2.2


tapies
02-17-2010, 08:53 AM
Please could you tell me why the code below works fine with SWFObject 1.5 (swf is dispayed OK) and not with SWFObject 2.2 (shows only Alternative HTML Content)?
Tested in IE6,7, FF3.5, Opera10.10, all look the same.

Thank you.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>TEST SWFObject</title>
<link href="mystyle.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>

<script type="text/javascript" src="swfobject.js"></script>

<!-- -->
<div id="flashcontent">
<div class="classDivA" id="DivA">
<h1>Alternative HTML Content</h1>
</div>
</div>
<!-- -->

<script type="text/javascript">
var so = new SWFObject("test.swf", "mymovie", "100%", "100%", "10", "#FFFFFF");
so.write("flashcontent");
</script>

</body>
</html>

yell0wdart
02-17-2010, 07:13 PM
Check out their SWFObject documentation (http://code.google.com/p/swfobject/wiki/documentation) when you have some time. If you read through, you'll note that 1.5 and 2.2 aren't compatible. Their API (http://code.google.com/p/swfobject/wiki/api) has changed a bit, and it appears that write() has been deprecated in favor of embedSWF().

tapies
02-18-2010, 07:19 AM
Thank you very much!

I replaced
<script type="text/javascript">
var so = new SWFObject("test.swf", "mymovie", "100%", "100%", "10", "#FFFFFF");
so.write("flashcontent");
</script>
with
<script type="text/javascript">
swfobject.embedSWF("test.swf", "myContent", "100%", "100%", "10", "#FFFFFF");
</script>

and it works!

Thanks a lot for your help, best regards.