Pacoteflash.system
Classepublic final class Capabilities
HerançaCapabilities Inheritance Object

The Capabilities class provides properties that describe the system and player that are hosting a SWF file. For exemplo, 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 exemplo 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 properties of the Capabilities class and corresponding server strings:

Capabilities class propertyServer string
avHardwareDisableAVD
hasAccessibilityACC
hasAudioA
hasAudioEncoderAE
hasEmbeddedVideoEV
hasIMEIME
hasMP3MP3
hasPrintingPR
hasScreenBroadcastSB
hasScreenPlaybackSP
hasStreamingAudioSA
hasStreamingVideoSV
hasTLSTLS
hasVideoEncoderVE
isDebuggerDEB
languageL
localFileReadDisableLFD
manufacturerM
osOS
pixelAspectRatioAR
playerTypePT
screenColorCOL
screenDPIDP
screenResolutionXR
screenResolutionYR
versionV

All properties of the Capabilities class are read-only.

Veja Exemplos



Propriedades Públicas
 PropriedadeDefinido por
  avHardwareDisable : Boolean
[static] [read-only] Specifies whether access to the user's camera and microphone has been administratively prohibited (true) or allowed (false).
Capabilities
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  hasAccessibility : Boolean
[static] [read-only] Specifies whether the system supports (true) or does not support (false) communication with accessibility aids.
Capabilities
  hasAudio : Boolean
[static] [read-only] Specifies whether the system has audio capabilities.
Capabilities
  hasAudioEncoder : Boolean
[static] [read-only] Specifies whether the system can (true) or cannot (false) encode an audio stream, such as that coming from a microphone.
Capabilities
  hasEmbeddedVideo : Boolean
[static] [read-only] Specifies whether the system supports (true) or does not support (false) embedded video.
Capabilities
  hasIME : Boolean
[static] [read-only] Specifies whether the system does (true) or does not (false) have an input method editor (IME) installed.
Capabilities
  hasMP3 : Boolean
[static] [read-only] Specifies whether the system does (true) or does not (false) have an MP3 decoder.
Capabilities
  hasPrinting : Boolean
[static] [read-only] Specifies whether the system does (true) or does not (false) support printing.
Capabilities
  hasScreenBroadcast : Boolean
[static] [read-only] Specifies whether the system does (true) or does not (false) support the development of screen broadcast applications to be run through Flash Media Server.
Capabilities
  hasScreenPlayback : Boolean
[static] [read-only] Specifies whether the system does (true) or does not (false) support the playback of screen broadcast applications that are being run through Flash Media Server.
Capabilities
  hasStreamingAudio : Boolean
[static] [read-only] Specifies whether the system can (true) or cannot (false) play streaming audio.
Capabilities
  hasStreamingVideo : Boolean
[static] [read-only] Specifies whether the system can (true) or cannot (false) play streaming video.
Capabilities
  hasTLS : Boolean
[static] [read-only] Specifies whether the system supports native SSL sockets through NetConnection (true) or does not (false).
Capabilities
  hasVideoEncoder : Boolean
[static] [read-only] Specifies whether the system can (true) or cannot (false) encode a video stream, such as that coming from a web camera.
Capabilities
  isDebugger : Boolean
[static] [read-only] Specifies whether the system is a special debugging version (true) or an officially released version (false).
Capabilities
  language : String
[static] [read-only] Specifies the language code of the system on which the content is running.
Capabilities
  localFileReadDisable : Boolean
[static] [read-only] Specifies whether read access to the user's hard disk has been administratively prohibited (true) or allowed (false).
Capabilities
  manufacturer : String
[static] [read-only] Specifies the manufacturer of Flash Player, in the format "Adobe OSName".
Capabilities
  os : String
[static] [read-only] Specifies the current operating system.
Capabilities
  pixelAspectRatio : Number
[static] [read-only] Specifies the pixel aspect ratio of the screen.
Capabilities
  playerType : String
[static] [read-only] Specifies the type of player.
Capabilities
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  screenColor : String
[static] [read-only] Specifies the screen color.
Capabilities
  screenDPI : Number
[static] [read-only] Specifies the dots-per-inch (dpi) resolution of the screen, in pixels.
Capabilities
  screenResolutionX : Number
[static] [read-only] Specifies the maximum horizontal resolution of the screen.
Capabilities
  screenResolutionY : Number
[static] [read-only] Specifies the maximum vertical resolution of the screen.
Capabilities
  serverString : String
[static] [read-only] A URL-encoded string that specifies values for each Capabilities property.
Capabilities
  version : String
[static] [read-only] Specifies the Flash Player or Adobe® Integrated Runtime (AIR™) platform and version information.
Capabilities
Métodos Públicos
 MétodoDefinido por
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Detalhes da propriedade
avHardwareDisablepropriedade
avHardwareDisable:Boolean  [read-only]

Specifies whether access to the user's camera and microphone has been administratively prohibited (true) or allowed (false). The server string is AVD.

For content in the Adobe Integrated Runtime (AIR), this property applies only to content in security sandboxes other than the application security sandbox. Content in the application security sandbox can always access the user's camera and microphone.


Implementação
    public static function get avHardwareDisable():Boolean

Veja também

hasAccessibilitypropriedade 
hasAccessibility:Boolean  [read-only]

Specifies whether the system supports (true) or does not support (false) communication with accessibility aids. The server string is ACC.


Implementação
    public static function get hasAccessibility():Boolean

Veja também

hasAudiopropriedade 
hasAudio:Boolean  [read-only]

Specifies whether the system has audio capabilities. This property is always true. The server string is A.


Implementação
    public static function get hasAudio():Boolean
hasAudioEncoderpropriedade 
hasAudioEncoder:Boolean  [read-only]

Specifies whether the system can (true) or cannot (false) encode an audio stream, such as that coming from a microphone. The server string is AE.


Implementação
    public static function get hasAudioEncoder():Boolean
hasEmbeddedVideopropriedade 
hasEmbeddedVideo:Boolean  [read-only]

Specifies whether the system supports (true) or does not support (false) embedded video. The server string is EV.


Implementação
    public static function get hasEmbeddedVideo():Boolean
hasIMEpropriedade 
hasIME:Boolean  [read-only]

Specifies whether the system does (true) or does not (false) have an input method editor (IME) installed. The server string is IME.


Implementação
    public static function get hasIME():Boolean

Veja também

hasMP3propriedade 
hasMP3:Boolean  [read-only]

Specifies whether the system does (true) or does not (false) have an MP3 decoder. The server string is MP3.


Implementação
    public static function get hasMP3():Boolean
hasPrintingpropriedade 
hasPrinting:Boolean  [read-only]

Specifies whether the system does (true) or does not (false) support printing. The server string is PR.


Implementação
    public static function get hasPrinting():Boolean
hasScreenBroadcastpropriedade 
hasScreenBroadcast:Boolean  [read-only]

Specifies whether the system 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.


Implementação
    public static function get hasScreenBroadcast():Boolean
hasScreenPlaybackpropriedade 
hasScreenPlayback:Boolean  [read-only]

Specifies whether the system 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.


Implementação
    public static function get hasScreenPlayback():Boolean
hasStreamingAudiopropriedade 
hasStreamingAudio:Boolean  [read-only]

Specifies whether the system can (true) or cannot (false) play streaming audio. The server string is SA.


Implementação
    public static function get hasStreamingAudio():Boolean
hasStreamingVideopropriedade 
hasStreamingVideo:Boolean  [read-only]

Specifies whether the system can (true) or cannot (false) play streaming video. The server string is SV.


Implementação
    public static function get hasStreamingVideo():Boolean
hasTLSpropriedade 
hasTLS:Boolean  [read-only]

Specifies whether the system supports native SSL sockets through NetConnection (true) or does not (false). The server string is TLS.


Implementação
    public static function get hasTLS():Boolean

Veja também

hasVideoEncoderpropriedade 
hasVideoEncoder:Boolean  [read-only]

Specifies whether the system can (true) or cannot (false) encode a video stream, such as that coming from a web camera. The server string is VE.


Implementação
    public static function get hasVideoEncoder():Boolean
isDebuggerpropriedade 
isDebugger:Boolean  [read-only]

Specifies whether the system is a special debugging version (true) or an officially released version (false). The server string is DEB.


Implementação
    public static function get isDebugger():Boolean
languagepropriedade 
language:String  [read-only]

Specifies the language code of the system on which the content 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 exemplo, 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:

LanguageValue
Czechcs
Danishda
Dutchnl
Englishen
Finnishfi
Frenchfr
Germande
Hungarianhu
Italianit
Japaneseja
Koreanko
Norwegianno
Other/unknownxu
Polishpl
Portuguesept
Russianru
Simplified Chinesezh-CN
Spanishes
Swedishsv
Traditional Chinesezh-TW
Turkishtr

The server string is L.


Implementação
    public static function get language():String

Exemplo

In the following exemplo, depending on the language of the user's operating system, different content is displayed.

The Capabilities.language property returns the ISO 639-1 language code (for exemplo, "en" for English). The switch statement checks for the language code and set the content of the myTextField text field to a greeting specific to the language. If the language code was not supported by the exemplo, a 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);
        }
    }
}
localFileReadDisablepropriedade 
localFileReadDisable:Boolean  [read-only]

Specifies whether read access to the user's hard disk has been administratively prohibited (true) or allowed (false). For content in the Adobe Integrated Runtime (AIR), this property applies only to content in security sandboxes other than the application security sandbox. (Content in the application security sandbox can always read from the file system.) If this property is true, Flash Player cannot read files (including the first file that Flash Player launches with) from the user's hard disk. If this property is true, AIR content outside of the application security sandbox cannot read files from the user's hard disk. For exemplo, 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.


Implementação
    public static function get localFileReadDisable():Boolean

Veja também

manufacturerpropriedade 
manufacturer:String  [read-only]

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.


Implementação
    public static function get manufacturer():String
ospropriedade 
os:String  [read-only]

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.


Implementação
    public static function get os():String
pixelAspectRatiopropriedade 
pixelAspectRatio:Number  [read-only]

Specifies the pixel aspect ratio of the screen. The server string is AR.


Implementação
    public static function get pixelAspectRatio():Number
playerTypepropriedade 
playerType:String  [read-only]

Specifies the type of player. This property can have one of the following values:

The server string is PT.


Implementação
    public static function get playerType():String
screenColorpropriedade 
screenColor:String  [read-only]

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.


Implementação
    public static function get screenColor():String
screenDPIpropriedade 
screenDPI:Number  [read-only]

Specifies the dots-per-inch (dpi) resolution of the screen, in pixels. The server string is DP.


Implementação
    public static function get screenDPI():Number
screenResolutionXpropriedade 
screenResolutionX:Number  [read-only]

Specifies the maximum horizontal resolution of the screen. The server string is R (which returns both the width and height of the screen).


Implementação
    public static function get screenResolutionX():Number
screenResolutionYpropriedade 
screenResolutionY:Number  [read-only]

Specifies the maximum vertical resolution of the screen. The server string is R (which returns both the width and height of the screen).


Implementação
    public static function get screenResolutionY():Number
serverStringpropriedade 
serverString:String  [read-only]

A URL-encoded string that specifies values for each Capabilities property.

The following exemplo 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


Implementação
    public static function get serverString():String
versionpropriedade 
version:String  [read-only]

Specifies the Flash Player or Adobe® Integrated Runtime (AIR™) 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.


Implementação
    public static function get version():String
Exemplos How to use examples
CapabilitiesExample.as

The following exemplo 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);
        }
    }
}