Wednesday, February 3, 2010

swfObject


swfObject is the small javascript library (10Kb / GZIPed: 3.9Kb), used to embed flash content  in your html page.
Major Advantages:
1.       1.  It detects if the browser has flash player to play the flash content.
2.      2.  It detect flash player version.
3.       3. Can be helpful to display an alternative content if your browser does not have flash player installed in it.
4.       4. SEO optimization of flash content.
5.       5. Better way around for <embed> tag which is not w3c valid tag.

How to Use?
1.       Download the library.
2.       Add it in your app.
<script type="text/javascript" src="swfobject.js"></script>
3.       Add some container in your html page which could hold the flash content.
e.g. <div id=”flashContent”>&nbsp;</div>
4.    <script type="text/javascript">
var so = new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#336699");
so.write("flashcontent");
</script>

What each parameter means:
var so = new SWFObject(swf, id, width, height, version, background-color);

Related Links: