Capabilities Object

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
Capabilities Object Flash 6

information about the Flash Player and its host system

Properties

hasAccessibility

Indicates whether the Player supports accessibility (MSAA).

hasAudio

Indicates whether the Player supports audio playback.

hasAudioEncoder

Indicates whether the system can encode audio.

hasMP3

Indicates whether the Player supports MP3 sound playback.

hasVideoEncoder

Indicates whether the system can encode video.

input

The user input device for the system, such as a mouse (indicated by the word "point").

isDebugger

Indicates whether the Player is a debugging version.

language

The current language setting on the operating system.

manufacturer

The creator of the Player.

os

The operating system on which the Player is running.

pixelAspectRatio

The width-to-height ratio of a pixel on the screen.

screenColor

The color mode supported by the screen (color, grayscale, or black and white).

screenDPI

The number of pixels per inch displayed by the screen.

screenResolutionX

The width of the screen, in pixels.

screenResolutionY

The height of the screen, in pixels.

serverString

All Capabilities property values, as a string of URL-encoded variables.

version

The Flash Player version.

Description

The Capabilities object represents the specifications of the Flash Player and the system on which the Player is running. It is stored as a property of the System object (i.e., System.capabilities). Hence, references to Capabilities properties always start with the System object, as follows:

System.capabilities.propertyName

For example, the following code displays the screen width in the Output window:

trace(System.capabilities.screenResolutionX);

The Capabilities object is used to write code that adapts a movie to its playback environment. It applies primarily to mobile devices, such as Pocket PCs and cell phones. For example, by querying the value of hasAudio, a movie playing on a handheld device can check if the device can play audio. If hasAudio is false, the movie can provide text subtitles.

All properties of Capabilities have corresponding short-form names and values that can be used to send the client-side Player abilities to a server-side script. For example, the screenColor property's short form is COL, with possible values of "color", "gray", and "bw". The capabilities.serverString property joins all short-form property name/value pairs into a URL-encoded string suitable for transmission to a server. A server can read this information and respond by sending the appropriate movie or data for the playback environment. See capabilities.serverString for details.

For information on authoring Flash movies for devices, see:

http://www.macromedia.com/software/flashplayer/resources/devices/
http://www.flashenabled.com/mobile/

For a list of devices that the Flash Player runs on, see:

http://www.macromedia.com/software/flashplayer/resources/devices/supported_devices/

Usage

Though the properties of Capabilities are writable, there is no practical reason to overwrite their system-assigned values. Doing so obscures the information they contain. Custom assignments to properties other than serverString are not reflected in the value of serverString.

See Also

The System object, the Stage object



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net