Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Flash 8: Checking for Flash Player

Macromedia Flash – Checking for Flash Player

Most people who visit your website will have the Flash Player 6, or later, plug-in installed. In rare circumstances, a visitor might not have the plug-in installed. You can do several different things when a visitor without Flash Player visits your site. When you have a site that uses Flash primarily for functionality, you might want to send that user to a custom page that links to the Macromedia site where the user can download the player.

The Check Plugin behavior in Dreamweaver enables you to verify whether visitors to your website have the Flash Player plug-in installed. After the behavior checks for a plug-in, you can route the visitor to different URLs, depending on whether they have the minimum required plug-in. For example, if the visitor doesn’t have Flash Player, you can open a page that links the visitor to the Macromedia website to download the latest version:

  1. In gnome.html, click inside the tag (click between the “y” the closing angle bracket) and open the Behaviors panel in Dreamweaver (Window > Behaviors).
  2. Click the Add (+) button and select Check Plugin from the behaviors pop-up menu.
  3. Select Flash from the Plugin pop-up menu.
  4. Leave the If Found, Go To URL text box blank. This text box controls what page the visitor with the specified plug-in sees. Leaving the text box blank ensures that users stays on the same page if they have Flash Player installed.
  5. Type a URL into the Otherwise, Go To URL text box. You need to specify an alternative URL for visitors who don’t have the Flash Player plug-in. Type noflash.html into the text box.

    Note: I provided a noflash.html document for you with the source files, included in the sample files that accompany this tutorial; it’s inside the finish folder. Either save this document in the same folder as the gnome.html document you’re working on or create your own file in this location. Ideally you would create a custom web page for users without Flash Player.

  6. Select the Always Go to First URL If Detection Is Not Possible check box. When selected, this option effectively means “assume that the visitor has the plug-in unless the browser explicitly indicates that the plug-in is not present.” Because you add an alternate ad for visitors without the plug-in, this option is preferable for this exercise. Figure 4 shows the selection you should have made up to this point to add Flash Player detection.

    Make these selections to add Flash Player detection in Dreamweaver using a behavior.

    Figure 4. Make these selections to add Flash Player detection in Dreamweaver using a behavior.

    1. Click OK. When you finish, Dreamweaver adds the following code to the <body> tag:

      <body id="container" onLoad="MM_checkPlugin('Shockwave Flash','',
      'noflash.html',true);return document.MM_returnValue">
      You can find the finished files in the source file directory,
      inside the finish folder.
  7. You can also add Flash Player detection in Flash authoring if you aren’t using Dreamweaver:

    Go to the Publish Settings dialog box (File > Publish Settings) and make sure that you select HTML in the Formats tab.

  8. Select the HTML tab.
  9. Select the Detect Flash Version check box and type a version of Flash Player to detect.

You can also refer to the Flash Player Detection Kit, which is built into Flash Professional 8, for documentation, articles, and sample files.

Summary

Now you have completed your first Flash site and inserted it into a Dreamweaver web page. You have learned how to create a new file, import content, create new assets in Flash, add simple animation and ActionScript, and publish your work for the web. You also learned how to use Dreamweaver to insert the SWF file into an existing web page, probably one that’s similar to a simple page you’ve created in the past.

This introductory step of learning Flash and adding a SWF file to a web page is an important one when you’re learning to use Flash. You now have the fundamentals under your belt and understand the essential nature and workflow of creating content with Flash. Hopefully you’ll feel better equipped to learn how to create increasingly interactive, entertaining, functional, or instructional content using Flash.

Where to Go from Here

In the final exercise, you added a Flash detection script. Dreamweaver’s plug-in behavior works well but there are certain times when you may need to customize the actions a bit more. For example, if you wanted to check for not only the existence of the Flash Player plug-in, but a specific version of the plug-in. Or you might want to display an alternate GIF or JPEG image if the user doesn’t have Flash Player. This means that instead of seeing a blank area on your page, or an area with a plug-in graphic, the visitor sees a static advertisement.

Comments