| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
The Capabilities class provides properties that describe the system and player
that are hosting a SWF file. For example, a mobile phone's screen might be 100 square
pixels, black and white, whereas a PC screen might be 1000 square pixels, color.
By using the Capabilities object to determine what type of device a user has,
you can provide appropriate content to as many users as possible. When you know
the device's capabilities, you can tell the server to send the appropriate SWF
files or tell the SWF file to alter its presentation.
You can send a player's capabilities information, which is stored in the
Capabilities.serverString property as a URL-encoded string, using the
GET or POST HTTP method. The following example shows a server
string for a computer that has MP3 support and 1600 x 1200 pixel resolution and that is
running Windows XP with an input method editor (IME) installed:
A=t&SA=t&SV=t&EV=t&MP3=t&AE=t&VE=t&ACC=f&PR=t&SP=t&
SB=f&DEB=t&V=WIN%209%2C0%2C0%2C0&M=Adobe%20Windows&
R=1600x1200&DP=72&COL=color&AR=1.0&OS=Windows%20XP&
L=en&PT=External&AVD=f&LFD=f&WD=f&IME=t
The following table lists the possible ActionScript properties and corresponding server strings:
| ActionScript property | Server string |
|---|
avHardwareDisable
|
AVD
|
hasAccessibility
|
ACC
|
hasAudio
|
A
|
hasAudioEncoder
|
AE
|
hasEmbeddedVideo
|
EV
|
hasIME
|
IME
|
hasMP3
|
MP3
|
hasPrinting
|
PR
|
hasScreenBroadcast
|
SB
|
hasScreenPlayback
|
SP
|
hasStreamingAudio
|
SA
|
hasStreamingVideo
|
SV
|
hasTLS
|
TLS
|
hasVideoEncoder
|
VE
|
isDebugger
|
DEB
|
language
|
L
|
localFileReadDisable
|
LFD
|
manufacturer
|
M
|
os
|
OS
|
pixelAspectRatio
|
AR
|
playerType
|
PT
|
screenColor
|
COL
|
screenDPI
|
DP
|
screenResolutionX
|
R
|
screenResolutionY
|
R
|
version
|
V
|
All properties of the Capabilities class are read-only.
View the examples
avHardwareDisable:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether access to the user's camera and microphone has
been administratively prohibited (true) or allowed (false).
The server string is AVD.
Implementation public static function get avHardwareDisable():BooleanSee also
hasAccessibility:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player is running in an environment that supports
(true) or does not support (false) communication
with accessibility aids.
The server string is ACC.
Implementation public static function get hasAccessibility():BooleanSee also
hasAudio:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player is running on a system that has audio
capabilities. This property is always true. The server
string is A.
Implementation public static function get hasAudio():BooleanhasAudioEncoder:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player can (true) or cannot (false)
encode an audio stream, such as that coming from a microphone.
The server string is AE.
Implementation public static function get hasAudioEncoder():BooleanhasColorCorrection:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 10 |
Specifies whether Flash Player is running on an operating system that supports
color correction and whether the color profile of the main (primary)
monitor can be read and understood by Flash Player.
This property should be true if you want to determine whether Flash Player
can display color correction (enableColorCorrection=true) on the current system.
The hasColorCorrection property applies only to the main monitor; the color profile of the main monitor is returned
regardless of which monitor the SWF file is on at the moment.
Implementation public static function get hasColorCorrection():BooleanSee also
hasEmbeddedVideo:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player is running on a system that supports
(true) or does not support (false)
embedded video. The server string is EV.
Implementation public static function get hasEmbeddedVideo():BooleanhasIME:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player is running on a system that does (true)
or does not (false) have an input method editor (IME) installed.
The server string is IME.
Implementation public static function get hasIME():BooleanSee also
hasMP3:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player is running on a system that does (true)
or does not (false) have an MP3 decoder.
The server string is MP3.
Implementation public static function get hasMP3():BooleanSee also
hasPrinting:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player is running on a system that does (true)
or does not (false) support printing.
The server string is PR.
Implementation public static function get hasPrinting():BooleanhasScreenBroadcast:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player does (true) or does not (false)
support the development of screen broadcast applications to be run through Flash Media
Server.
The server string is SB.
Implementation public static function get hasScreenBroadcast():BooleanhasScreenPlayback:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player does (true) or does not
(false) support the playback of screen broadcast applications
that are being run through Flash Media Server.
The server string is SP.
Implementation public static function get hasScreenPlayback():BooleanhasStreamingAudio:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player can (true) or cannot (false)
play streaming audio.
The server string is SA.
Implementation public static function get hasStreamingAudio():BooleanhasStreamingVideo:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player can (true) or cannot
(false) play streaming video.
The server string is SV.
Implementation public static function get hasStreamingVideo():BooleanhasTLS:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player is on a system that supports native SSL sockets through NetConnection
(true) or does not (false).
The server string is TLS.
Implementation public static function get hasTLS():BooleanSee also
hasVideoEncoder:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player can (true) or cannot
(false) encode a video stream, such as that coming
from a web camera.
The server string is VE.
Implementation public static function get hasVideoEncoder():BooleanisDebugger:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player is a special debugging version
(true), or an officially released version (false).
The server string is DEB.
Implementation public static function get isDebugger():BooleanisEmbeddedInAcrobat:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether the player is embedded in a PDF file that is open in Acrobat 9.0 or higher
(true) or not (false).
Implementation public static function get isEmbeddedInAcrobat():Booleanlanguage:String [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies the language code of the system on which the player is running. The language is
specified as a lowercase two-letter language code from ISO 639-1. For Chinese, an additional
uppercase two-letter country code from ISO 3166 distinguishes between Simplified and
Traditional Chinese. The languages codes are based on the English names of the language: for example,
hu specifies Hungarian.
On English systems, this property returns only the language code (en), not
the country code. On Microsoft Windows systems, this property returns the user interface (UI)
language, which refers to the language used for all menus, dialog boxes, error messages, and help
files. The following table lists the possible values:
| Language | Value |
|---|
| Czech | cs |
| Danish | da |
| Dutch | nl |
| English | en |
| Finnish | fi |
| French | fr |
| German | de |
| Hungarian | hu |
| Italian | it |
| Japanese | ja |
| Korean | ko |
| Norwegian | no |
| Other/unknown | xu |
| Polish | pl |
| Portuguese | pt |
| Russian | ru |
| Simplified Chinese | zh-CN |
| Spanish | es |
| Swedish | sv |
| Traditional Chinese | zh-TW |
| Turkish | tr |
The server string is L.
Implementation public static function get language():String Example In the following example, the content that is displayed depends on the language of the user's operating
system.
The Capabilities.language property returns the ISO 639-1 language code
(for example, "en" for English). The switch statement checks for the language code and sets
the content of the myTextField text field to a greeting specific to the
language. If the language code is not supported by the example, the default error string
is returned.
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.system.Capabilities;
public class Capabilities_languageExample extends Sprite {
public function Capabilities_languageExample() {
var myTextField:TextField = new TextField();
myTextField.x = 10;
myTextField.y = 10;
myTextField.background = true;
myTextField.autoSize = TextFieldAutoSize.LEFT;
var greetingEnglish:String = "Hello World";
var greetingGerman:String = "Hallo Welt";
var greetingFrench:String = "Bonjour Monde";
var greetingSpanish:String = "Hola Mundo";
var lang:String = Capabilities.language;
switch (lang) {
case "en":
myTextField.text = greetingEnglish;
break;
case "de":
myTextField.text = greetingGerman;
break;
case "fr":
myTextField.text = greetingFrench;
break;
case "es":
myTextField.text = greetingSpanish;
break;
default:
myTextField.text = "Sorry your system's language is not supported at this time.";
}
this.addChild(myTextField);
}
}
}
localFileReadDisable:Boolean [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies whether read access to the user's hard disk has been
administratively prohibited (true) or allowed
(false). If this property is true,
Flash Player cannot read files (including the first SWF file that
Flash Player launches with) from the user's hard disk. For example,
attempts to read a file on the user's hard disk using load methods
will fail if this property is set to true.
Reading runtime shared libraries is also blocked if this property
is set to true, but reading local shared objects is
allowed without regard to the value of this property.
The server string is LFD.
Implementation public static function get localFileReadDisable():BooleanSee also
manufacturer:String [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies the manufacturer of Flash Player, in the format "Adobe
OSName". The value for OSName
could be "Windows", "Macintosh",
"Linux", or another operating system name. The server string is M.
Implementation public static function get manufacturer():Stringos:String [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies the current operating system. The os property
can return the following strings: "Windows XP", "Windows 2000",
"Windows NT", "Windows 98/ME", "Windows 95",
"Windows CE" (available only in Flash Player SDK, not in the desktop version),
"Linux", and "MacOS".
The server string is OS.
Implementation public static function get os():StringpixelAspectRatio:Number [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies the pixel aspect ratio of the screen. The server string
is AR.
Implementation public static function get pixelAspectRatio():NumberplayerType:String [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies the type of player. This property can have one of the following
values:
"StandAlone" for the stand-alone Flash Player"External" for the external Flash Player or in test mode"PlugIn" for the Flash Player browser plug-in"ActiveX" for the Flash Player ActiveX control used by Microsoft Internet Explorer
The server string is PT.
Implementation public static function get playerType():StringscreenColor:String [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies the screen color. This property can have the value
"color", "gray" (for grayscale), or
"bw" (for black and white).
The server string is COL.
Implementation public static function get screenColor():StringscreenDPI:Number [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies the dots-per-inch (dpi) resolution of the screen, in pixels.
The server string is DP.
Implementation public static function get screenDPI():NumberscreenResolutionX:Number [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies the maximum horizontal resolution of the screen.
The server string is R (which returns both the width and height of the screen).
This property does not update with a user's screen resolution and instead only indicates the resolution at the time
Flash Player started. Also, the value only specifies the main monitor.
Implementation public static function get screenResolutionX():NumberSee also
screenResolutionY:Number [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies the maximum vertical resolution of the screen.
The server string is R (which returns both the width and height of the screen).
This property does not update with a user's screen resolution and instead only indicates the resolution at the time
Flash Player started. Also, the value only specifies the main monitor.
Implementation public static function get screenResolutionY():NumberSee also
serverString:String [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
A URL-encoded string that specifies values for each Capabilities
property.
The following example shows a URL-encoded string:
A=t&SA=t&SV=t&EV=t&MP3=t&AE=t&VE=t&ACC=f&PR=t&SP=t&
SB=f&DEB=t&V=WIN%208%2C5%2C0%2C208&M=Adobe%20Windows&
R=1600x1200&DP=72&COL=color&AR=1.0&OS=Windows%20XP&
L=en&PT=External&AVD=f&LFD=f&WD=f
Implementation public static function get serverString():StringSee also
version:String [read-only]
| Language Version : | ActionScript 3.0 |
| Player Version : | Flash Player 9 |
Specifies the Flash Player platform and version information.
The format of the version number is: platform majorVersion, minorVersion,
buildNumber, internalBuildNumber.
Possible values for platform are "WIN",
"MAC", and "UNIX". Here are some examples of
version information:
WIN 9,0,0,0 // Flash Player 9 for Windows
MAC 7,0,25,0 // Flash Player 7 for Macintosh
UNIX 5,0,55,0 // Flash Player 5 for UNIX
The server string is V.
Implementation public static function get version():StringSee also
The following example simply outputs the values found in the
flash.system.Capabilities object using several calls to
trace().
package {
import flash.display.Sprite;
import flash.system.Capabilities;
public class CapabilitiesExample extends Sprite {
public function CapabilitiesExample() {
showCapabilities();
}
private function showCapabilities():void {
trace("avHardwareDisable: " + Capabilities.avHardwareDisable);
trace("hasAccessibility: " + Capabilities.hasAccessibility);
trace("hasAudio: " + Capabilities.hasAudio);
trace("hasAudioEncoder: " + Capabilities.hasAudioEncoder);
trace("hasEmbeddedVideo: " + Capabilities.hasEmbeddedVideo);
trace("hasMP3: " + Capabilities.hasMP3);
trace("hasPrinting: " + Capabilities.hasPrinting);
trace("hasScreenBroadcast: " + Capabilities.hasScreenBroadcast);
trace("hasScreenPlayback: " + Capabilities.hasScreenPlayback);
trace("hasStreamingAudio: " + Capabilities.hasStreamingAudio);
trace("hasVideoEncoder: " + Capabilities.hasVideoEncoder);
trace("isDebugger: " + Capabilities.isDebugger);
trace("language: " + Capabilities.language);
trace("localFileReadDisable: " + Capabilities.localFileReadDisable);
trace("manufacturer: " + Capabilities.manufacturer);
trace("os: " + Capabilities.os);
trace("pixelAspectRatio: " + Capabilities.pixelAspectRatio);
trace("playerType: " + Capabilities.playerType);
trace("screenColor: " + Capabilities.screenColor);
trace("screenDPI: " + Capabilities.screenDPI);
trace("screenResolutionX: " + Capabilities.screenResolutionX);
trace("screenResolutionY: " + Capabilities.screenResolutionY);
trace("serverString: " + Capabilities.serverString);
trace("version: " + Capabilities.version);
}
}
}
© 2004-2008 Adobe Systems Incorporated. All rights reserved.
Tue May 20 2008, 04:02 AM -07:00