swfobject is a great tool for serving flash in a standards-based, accessible way.
Version 2.1 is available at google code – here’s the link: code.google.com/p/swfobject/
Main Advantages:
- It’s more optimized and flexible than any other Flash Player embed method around.
- It uses unobtrusive JavaScript.
- It offers a standards-based, accessible way to serve flash.
- It allows you to avoid click-to-activate mechanisms to activate active content in Internet Explorer 6/7 and Opera 9+.
There are two publishing methods: static publishing method & dynamic publishing method.
Both methods allow you to use standards-based markup and a way to serve alternative content (including a option to install / upgrade your flash) if flash isn’t supported.
The main advantage of the static publishing method is: If you have the Flash plug-in installed, but have JavaScript disabled or a use a browser that doesn’t support JavaScript, you will still be able to see your Flash content.
Usually there’s a good reason why JavaScript isn’t supported. W3C schools Browser Stats states 95% of users have JavaScript On. So unless you specifically want to cater for devices like Sony PSP (which has very poor JavaScript support) the dynamic publishing method is recommended.
The advantages of the dynamic publishing method are: It avoids click-to-activate mechanisms to activate active content in Internet Explorer 6/7 and Opera 9+.
Using parameters:
There aren’t a lot of examples of using parameters. Here’s an example for making movies transparent. This is often necessary to have DHTML elements appear ABOVE the flash movies (as well as content / imagery below.)
<script type="text/javascript">
// <![CDATA[
var flashvars = false;
var params = {
quality: "high",
wmode: "transparent",
scale: "noscale"
};
var attributes = {};
swfobject.embedSWF("/flash/movie.swf", "flashcontentID",
"550", "400", "6.0.0", "false", flashvars,
params, attributes);
// ]]>
</script>
Bugs:
There appears to be an unresolved issue where the flash movie doesn’t load in Internet Explorer 7. You can find more details at the flashcomguru.com forum
Adobe state only a very small number of IE7 users are affected but many users believe the issue is more widespread.
Setting the flash version to "0" does solve the issue. But if the user doesn’t have flash the alternative content is not served. Adobe.com’s player census state about 98% of users have flash player version 7 and above installed. (Only 80% use version 9 so this solution would not be satisfactory).
<!--[if !IE 7]><!-->
<script type="text/javascript">
// <![CDATA[
swfobject.embedSWF("/flash/movie.swf", "flashcontentID",
"550", "400", "6.0.0", "false", flashvars,
params, attributes);
// ]]>
</script>
<!--<![endif]-->
<!--[if IE 7]><!-->
<script type="text/javascript">
// <![CDATA[
swfobject.embedSWF("/flash/movie.swf", "flashcontentID",
"550", "400", "0", "false", flashvars,
params, attributes);
// ]]>
</script>
<!--<![endif]-->
Alternatively, use the alternative content to embed the movie and then use a src=”image.gif” with details describing what’s happening / what steps to take.
Note: Not sure how using using expressinstall.swf affects this issue.