Installing an AIR application from the browser

A SWF file can install an AIR application by calling the installApplication() method in the air.swf file loaded from http://airdownload.adobe.com/air/browserapi/air.swf. For details, see Loading the air.swf file.

Once the air.swf file is loaded, the SWF file can call the air.swf file’s installApplication() method, as in the following code:

     var url:String = "http://www.example.com/myApplication.air"; 
 var runtimeVersion:String = "1.0"; 
 var arguments:Array = ["launchFromBrowser"]; // Optional 
 airSWF.installApplication(url, runtimeVersion, arguments); 
 

The installApplication() method installs the specified application on the user’s machine. This method has the following parameters:

Parameter

Description

url

A string defining the URL of the AIR file to install. You must use an absolute, not relative, URL path.

runtimeVersion

A string indicating the version of the runtime (such as "1.0") required by the application to be installed.

arguments

An array of arguments to be passed to the application if it is launched upon installation. Only alphanumerical characters are recognized in the arguments. If you need to pass other values, consider using an encoding scheme.

The application is launched upon installation if the allowBrowserInvocation element is set to true in the application descriptor file. (For more information on the application descriptor file, see AIR application descriptor files.) If the application is launched as the result of a seamless install from the browser (with the user choosing to launch upon installation), the application’s NativeApplication object dispatches a BrowserInvokeEvent object only if arguments have been passed. For details, see Launching an installed AIR application from the browser.

The installApplication() method can only operate when called in the event handler for a user event, such as a mouse click.

The installApplication() method throws an error if the required version of Flash Player (version 9 update 3 or later on Windows and Mac OS, or version 10 on Linux) is not installed in the browser.

On Mac OS, to install an updated version of an application, the user must have adequate system privileges to install to the application directory (and administrative privileges if the application updates the runtime). On Windows, a user must have administrative privileges.

You may also call the getApplicationVersion() method of the air.swf file to check if an application is already installed. You can call this method either before the application installation process begins or after the installation is started. For details, see Checking from a web page if an AIR application is installed. Once the application is running, it can communicate with the SWF content in the browser by using the LocalConnection class. For more information, see Communicating with other Flash Player and AIR instances (for ActionScript developers) or Communicating with other Flash Player and AIR instances (for HTML developers).

Adobe logo

Sign in to your account