When you're building a site or web page that incorporates Adobe Flash, you need to include coding that determines if the user has the plug-in installed, and if so, which version is being used. Several methods of doing this have been used, but the SWFObject approach has become the standard.
What Is SWFObject?
Beginning with its CS4 products, Adobe adopted the SWFObject approach for embedding Flash content into an HTML page. The approach replaces the earlier methods of Adobe Flash Player Detection Kit, SWFObject 1.5 and UFO.
The latest version of SWFObject, 2.0, is an ongoing attempt to unify all the existing Flash Player embed methods while creating a web standard, browser-compliant approach that can be used across all operating systems and browsers.
How It Works
Creating the Code
Before creating the coding, you will need some files and the generator. Get these by:
- Downloading the SwfObject 2.2 files (a zip file)
- Downloading and installing Adobe Air to run the code generator (zip file)
What the Files Do
When you extract the SwfObject 2.2 zip file, you will find a handful of swf, js, and other example files. The two files you need are expressInstall.swf and swfobject.js. If you include expressInstall.swf in your site's directory, it will allow the user's Flash player to update to the correct version from within the browser when he or she visits your page, provided the user already has a lower version of Flash installed.
Using the Generator
- Open the generator using Air.
- Choose either static or dynamic publishing.
- Set the version of Flash required for your content.
- Input the name of your Flash file inside the SWF definition box.
- Fill out the dimensions of the Flash file.
- Click on more to adjust and set any parameters or attributes, such as setting a background color or whether to auto play or loop the Flash movie.
- Once all variables are set, make adjustments to the HTML definitions, if desired.
- Click on Generate.
Using the Code
When Flash is used, it's standard coding practice to include alternative content for users that do not have the Flash player installed on their machine. The default alternative content pre-loaded by the generator is coding to display the "Get Adobe Flash Player" image. You can keep that content or alter it to best suit your needs.
Mobile and Flash
Displaying Flash on mobile devices is one dilemma that SWFObject cannot address since the format is not supported by Apple and even Adobe abandoned support for Android devices a few years ago. So, if your site will target a substantial mobile audience, avoid Flash and use HTML5 technologies to deliver your media-enriched content.