Tech Tee Shirts Explained »

Embedding Flash on Page using SWFObject

Let's say that you have a Flash SWF file, how do you embedded that Flash on a webpage? Consider using swfObject.  As mentioned in its Wiki, swfObject "Intends to unify all existing Flash Player embed methods and provide a new standard for embedding Adobe Flash Player content". The code is open-source, so there is no charge.

Sure, you can use Abode Flash to open up the Flash source file (FLA file) to generate the SWF and HTML files.  And it would give you the code for embedded Flash on a web page.

But if in the case that you had just been given the SWF file without the source.  Or perhaps one of the screencast tools or other utility generated the SWF Flash output.  Then you can alway embedded the Flash using SWFObject.  In fact, if you Abobe Flash can generate the HTML output, you might still want to use SWFObject code to place the Flash object on your webpage. 

The reason is that SWFObject has the ability to provide alternate content if in the case that your user does not have Flash.  SWFObject's code is also designed to be cross-browser compatible.

You can download the SWFObject code, read the documentation on how to use it, and ask questions on the Google group.  There is two methods of embedded the Flash: 1) the static method and the dynamic method.  If you want to start off easy, use the static method.  The dynamic method will give you greater flexibility. 

Be sure to read their FAQ. In particular, FAQ #4 explains what you have to do in order to not have IE6 browser crash when running swfobject.