While DWCS4 includes shortcuts to adding this code, it’s a simple task to hook up the code yourself.
Follow these steps for a quick start.
- Download the SWFObject js library. Google provides a page with a link to the latest version of the js file package for download.
Add another script tag containing information about your SWF file. Make sure the path to your swf file is correct. In the example below, the SWF to be displayed on this page is named game.swf and is located inside a folder named flash.
- Add a DIV element in the BODY of your page. The SWF file will be displayed inside this element. Add an ID attribute matching the value specified in your script tag e.g.
- You can add any amount of “alternative” content inside the div box. If your flash movie cannot play for any reason, the alternative content will be displayed instead.
No flash Movie!
Load the page in another browser or force the movie to play in your browser by using the file > open menu command on your browser. Safari users can try dragging the SWF file into an open browser window. If nothing shows, go to the Adobe flash site and test your browser for flash compatibility.
Check your file paths are correct by replacing the page file name in your URL address bar with the path you have written in your script tag. You must be absolutely sure these paths are correct.
In more detail
The above steps cover the absolute minimum you need to do. There’s a lot of options including player version checking, file source file locations, alternative content display and browser compatibility. Check the following links for more information.
SWFObject 2.0x Documentation on the google code site.
Bobby Van Der Sluis’s in-depth analysis of the issues surrounding SWF player deployment on A List Apart.
Google now provides an online code repository, so you don’t even have to download the scripts!