Accessibility

Adobe AIR Article

 

Deploying Adobe AIR applications seamlessly with badge install


Table of Contents

Integrating Express Install

Using the process outlined above could leave a large percentage of your potential users with a manual installation, because only users with the latest version of Flash Player can benefit from the convenience of the Adobe AIR install badge. However, using the Express Install feature of the Flash Player Detection Kit will allow you to have the user update his or her Flash Player without ever leaving your site.

The necessary files for this implementation are included with the exercise file for this article. They also can be obtained by downloading the Flash Player Detection Kit from Adobe.

How it works

For users to take advantage of Express Install they must have Flash Player version 6.0.65 or later installed. In that case, Express Install will attempt to determine what version of Flash Player the user has. If the version is less than the version that has been defined, Express Install will ask users if they would like to install the latest version of the Flash Player from your site (see Figure 5).

Using the Express Install feature

Figure 5. Using the Express Install feature

After the installation process is completed, the page will be reloaded, and the Flash content will be displayed correctly.

Using Express Install

The Express Install feature of the Flash Player Detection Kit adds a few steps to the version detection process. In a standard configuration the following steps are performed:

  1. Verify whether the user has at least version 6.0.65 of Flash Player. If not, the alternate content will be shown.
  2. Verify whether the user has at least the version of Flash Player that is defined in the script block at the top of the page. If not, the file playerProductInstall.swf will be loaded and the express installation will begin. A redirect URL is passed to the playerProductInstall.swf file (which is the current page by default). After the installation process is completed, this page will be reloaded.
  3. When the correct version of Flash Player is detected, the correct Flash SWF file will be loaded.

Just as with Flash Player detection, the installation process requires JavaScript. If the user does not have JavaScript enabled, he or she will see only what is in the <noscript> block. The Flash Player Detection Kit contains a sample HTML file that integrates the Express Install feature. This file can serve as a template for when you need to integrate Express Install with your Flash movies.

Using the included script

The file InstallBadge.js that is included with this article's exercise files can be used to easily add the Express Install functionality with the Adobe AIR install badge. It combines code from the Adobe AIR SDK install badge example with the Flash Player Detection Kit Express Install example. It also detects what platform the user is using, and can direct he or she to the URL of the AIR installation if it cannot be installed automatically.

To properly integrate the Express Install functionality and simplify the code that will have to be modified, you will need to include a the following global variables in your document:

// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 115;
// AIR Version Required
var airVersion = "1.0.M6";
// AIR Application Name
var airApplicationName = "Sample Application";
// AIR Application URL
var airApplicationURL = "http://www.davidtucker.net/airtips/sampleApplication-1.air";
// AIR Application Image
var airApplicationImage = "sample.jpg";

You can also define the width, height, button color, message color, and a directory for each of the SWF files (documentation for InstallBadge.js can be found with the exercise files for this article). When the variables are defined, you can insert the two JavaScript files that are required to insert the AIR Install Badge. You will insert these in the position where you want the install badge to appear.

<script src="AC_RunActiveContent.js" language="javascript"></script>
<script src="InstallBadge.js" language="javascript"></script>

You will also need to add a <noscript> block manually. This will enable those users who have JavaScript disabled to manually install your application. To further streamline the process, you can insert the direct links to Adobe AIR for both Windows and Mac OS X. This enables users to install your application in only two clicks.

<noscript>
<table id="AIRDownloadMessageTable">
<tr><td>
Download <a href="http://www.davidtucker.net/sampleApplication.air">Sample Application</a> now.<br /><br />
<span id="AIRDownloadMessageRuntime">
This application requires the Adobe&#174;&nbsp;AIR&#8482; runtime to be installed for
<a href="http://airdownload.adobe.com/air/mac/download/1.0/AdobeAIR.dmg">Mac OS</a> or
<a href="http://airdownload.adobe.com/air/win/download/1.0/AdobeAIRInstaller.exe">Windows</a>.</span>
</td></tr>
</table>
</noscript>

If you now test the sample, it should function properly. If you don't have at least Flash Player version 9.0.115 installed, you should see the dialog box shown in Figure 3. If you don't have JavaScript enabled, you should see the manual installation instructions from Figure 2. After you click the Install Now button, the badge will install the application.

Where to go from here

With Adobe AIR 1.0, you can now detect and launch installed air applications. With the files included with this article, you can easily deploy your applications to virtually anyone on the Internet from your site. You also can easily extend this example and create your own badges in Flash or Flex using the example that is included with the Adobe AIR SDK. By doing this, you can create a badge that matches the look and feel of your site, or integrate an install badge into an already existing Flex application.