Using the Capabilities class

Flash Player 9 and later, Adobe AIR 1.0 and later

The Capabilities class allows developers to determine the environment in which an application is being run. Using various properties of the Capabilities class, you can find out the resolution of the user’s system, whether the user’s system supports accessibility software, and the language of the user’s operating system, as well as the currently installed version of the Flash runtime.

By checking the properties in the Capabilities class, you can customize your application to work best with the specific user’s environment. For example, by checking the Capabilities.screenResolutionX and Capabilities.screenResolutionY properties, you can determine the display resolution the user’s system is using and decide which video size may be most appropriate. Or you can check the Capabilities.hasMP3 property to see if the user’s system supports mp3 playback before attempting to load an external mp3 file.

The following code uses a regular expression to parse the Flash runtime version that the client is using:

var versionString = air.Capabilities.version; 
var pattern = /^(\w*) (\d*),(\d*),(\d*),(\d*)$/; 
var result = pattern.exec(versionString); 
if (result != null) 
    air.trace("input: " + result.input); 
    air.trace("platform: " + result[1]); 
    air.trace("majorVersion: " + result[2]); 
    air.trace("minorVersion: " + result[3]);     
    air.trace("buildNumber: " + result[4]); 
    air.trace("internalBuildNumber: " + result[5]); 
    air.trace("Unable to match RegExp."); 

// Ethnio survey code removed