We all know the SWFObject and how it works; let’s see how to implement it in our webpages in just few seconds.
This syntax only applies to the SWFObject v. 2.1 available at googlecode.
- Browse to code.google.com/p/swfobject/ and download the latest release;
- unzip the files to your swfobject folder;
- between the ‘head’ tags of your document just put the following:
<script type="text/javascript" src="/folder/swfobject.js" language="javascript"></script> <script type="text/javascript" language="javascript"> var flashvars = {}; var params = {}; params.wmode = "transparent"; params.menu = "hidden"; var attributes = {}; attributes.id = "your_id"; swfobject.embedSWF("/swf/your.swf", "your_id", "your_width", "your_height", "9.0.0", "expressInstall.swf", flashvars, params, attributes); </script> - between the ‘body’ tags of your document just put this:
<div id="your_id"> <img src="/images/alternative_image.png" alt="" /></div>
I always use an alternative image in case the user’s browser has not the flash plugin installed, so he may see an alternative content. Otherwise you can always put some text between the ‘div’ tags .
This is it, just test your page and see it at work; should you need more parameters just browse to the sfwobject documentation.
