Book Image

WordPress and Flash 10x Cookbook

Book Image

WordPress and Flash 10x Cookbook

Overview of this book

WordPress is much more than just a blogging platform now. This flexible CMS is the power behind millions of URLs, including blue-chip companies, small business, and personal websites. Flash is a world-famous multimedia platform. This book will show you the best of the proven and popular strategies and techniques to deliver rich multimedia content, which will let you sail through the world of Flashy Wordpress with ease.This book will take you through clear well-formed and comprehensive recipes, through the most essential and useful Flash multimedia tools for Wordpress available today including plugins for images, audio and video, as well as projects you can do yourself in Flash. It helps you to create a Wordpress website full of Flash content. We show the big picture by providing context, best practices and strategies. Detailed instructions are provided for each section. This book provides you with the shortlist of the most essential Flash tools for creating a dynamic and media-rich website or blog, and shows you how to implement these on your site. The sections on Flash are intended to give you the option to create custom .swf files, giving you an alternative to plugins that already exist. The book will show you how to configure Flash content in your WordPress site/blog for maximum SEO, introduce Flash content to your Wordpress with and without plugins, import image feeds, use lightbox effects, and much more.
Table of Contents (17 chapters)
Wordpress and Flash 10x Cookbook
Credits
About the Authors
About the Reviewers
Preface
WordPress Resources
Flash Resources

Adding Flash detection with Flash-generated JavaScript


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.

Getting ready

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.

How to do it...

  1. 1. In Flash, go to File | Open. Navigate to the javascript_test.fla file (or use your own .fla file) and open it.

  2. 2. Go to File | Publish Settings.

  1. 3. Make sure that Flash and HTML are checked, as shown in the previous screenshot.

  2. 4. Click on the Flash tab at the top of the dialog box, as seen below.

  1. 5. In the top section of the dialog box now showing, set the Player to the version you are targeting.

Note

In order for Flash to generate the appropriate code, you must target Flash Player 4 or higher.

  1. 6. Click on the HTML tab at the top of the dialog box, as seen below.

  1. 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.

  2. 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.

  3. 9. The .swf can be moved to the root level of your site as needed.

  4. 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>

How it works...

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.

See also

  • Using the Kimili plugin to incorporate a .swf

  • Adding Flash Detection with swfObject 2.x