This week’s tech tool is actually a JavaScript file that makes loading Flash content onto your HTML pages incredibly easy.

SWFObject (or SWF Fix as some of you may still know it by) can detect the Flash plug-in for all major web browsers and is also very search engine friendly, degrades gracefully and creates valid HTML.

Flash Object

The code is as simple as follows:

<script type="text/javascript" src="script/swfobject.js"></script>
<div id="swfcontainer">
    <p>Sorry, you don't appear to have Flash installed</p>
</div>
<script language="javascript" type="text/javascript">
<!--
    var soPlay = new SWFObject("movie.swf", "Movie name",
                                "926", "530", "8", "#ffff03");
    soPlay.addParam("quality", "best");
    soPlay.addParam("wmode", "window");
    soPlay.write("swfcontainer");
//-->
</script>

The DIV “swfcontainer” is where our Flash movie will be written to, so should contain some text to alert the user should it be unable to load. While building our Flash player, we can use the default parameters, or add our own using the addParam property.

If you’re still not sure it’s the best solution for you, please check out this article on A List Apart.

Tags: , ,

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>