-
Book Overview & Buying
-
Table Of Contents
WordPress and Flash 10x Cookbook
If you want to add Flash player detection to your web page, but do not want to reference an external file, this recipe offers an easy solution. Use the Flash Professional IDE to generate the .html page for you that contains JavaScript to detect a Flash player and will play your .swf. Then, copy/paste the needed code into your template in WordPress.
Make sure you have access to the javascript_test.fla file so that you can open the file and allow Flash to generate additional files in that same location. It is currently located in the Detection with Flash JavaScript folder inside the folder forChapter 1. Change the location of this file as you need.
1. In Flash, go to File | Open. Navigate to the javascript_test.fla file (or use your own .fla file) and open it.
2. Go to File | Publish Settings.

3. Make sure that Flash and HTML are checked, as shown in the previous screenshot.
4. Click on the Flash tab at the top of the dialog box, as seen below.

5. In the top section of the dialog box now showing, set the Player to the version you are targeting.
In order for Flash to generate the appropriate code, you must target Flash Player 4 or higher.
6. Click on the HTML tab at the top of the dialog box, as seen below.

7. In the top section of the dialog box now showing, set the Template to either Flash Only or Flash HTTPS, check the box for Detect Flash Version, and type in the specific version of Flash to be targeted.
8. Click Publish at the bottom of the dialog box. A .swf file and .html file have now been created for you. The .html file holds a reference to the .swf as well as the JavaScript necessary for basic Flash Player detection.
9. The .swf can be moved to the root level of your site as needed.
10. Copy/paste the Flash detection code into a Template in WordPress.
For the head section, copy/paste everything from<script> to</script>
For the body section, copy/paste everything from<script> to</noscript>
You enter the necessary preferences for your .swf and .html files into the Publish Settings dialog box. When you click Publish, Flash generates the requested files. As long as the .html template you publish is either Flash Only or Flash HTTPS, the .html file will be generated with JavaScript, set up to detect the Flash Player you specified. If the appropriate Flash Player version is not detected, alternative information is displayed so that the viewer has the option to download the targeted and necessary version of the Flash player.
Using the Kimili plugin to incorporate a .swf
Adding Flash Detection with swfObject 2.x
Change the font size
Change margin width
Change background colour