Packageflash.system
Classpublic final class System
InheritanceSystem Inheritance Object

Language version: ActionScript 3.0
Runtime version: 

The System class contains properties related to local settings and operations. Among these are settings for camers and microphones, operations with shared objects and the use of the Clipboard.

Additional properties and methods are in other classes within the flash.system package: the Capabilities class, the IME class, and the Security class.

This class contains only static methods and properties. You cannot create new instances of the System class.

View the examples.

See also

flash.system.Security
flash.events.IMEEvent


Public Properties
 PropertyDefined by
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  containsDebugInfo : Boolean
[static][read-only] Property to check whether any loaded SWF has contained debug information.
System
  freeMemory : Number
[static][read-only] The amount of memory (in bytes) that is allocated to Adobe® Flash® Player or Adobe® AIR® and that is not in use.
System
  ime : IME
[static][read-only] The currently installed system IME.
System
  poisonStrings : Boolean
[static][write-only] Sets a flag to poison the memory used by any String object when it is garbage collected.
System
  privateMemory : Number
[static][read-only] The entire amount of memory (in bytes) used by an application.
System
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  totalMemory : uint
[static][read-only] The amount of memory (in bytes) currently in use that has been directly allocated by Flash Player or AIR.
System
  totalMemoryNumber : Number
[static][read-only] The amount of memory (in bytes) currently in use that has been directly allocated by Flash Player or AIR.
System
  useCodePage : Boolean
[static] A Boolean value that determines which code page to use to interpret external text files.
System
Public Methods
 MethodDefined by
  
decryptBlob(data:Class, key:String = null):ByteArray
[static] Decrypts a built-in BinaryData blob into a byte array object.
System
  
[static] Makes the specified XML object immediately available for garbage collection.
System
  
error(errString:String):void
[static] Output a string to the console via 'stderr'.
System
  
exit(code:uint):void
[static] Closes Flash Player.
System
  
gc():void
[static] Forces the garbage collection process.
System
 Inherited
Indicates whether an object has a specified property defined.
Object
  
[static] Request a string input from the user via the console.
System
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
output(outString:String):void
[static] Output a string to the console via 'stdout'.
System
  
[static] Pauses Flash Player or the AIR Debug Launcher (ADL).
System
  
[static] Advise the garbage collector that if the collector's imminence exceeds the function's imminence parameter then the collector should finish the incremental collection cycle.
System
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
  
[static] Resumes the application after calling System.pause().
System
  
[static] Replaces the contents of the Clipboard with a specified text string.
System
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Property detail
containsDebugInfoproperty
containsDebugInfo:Boolean  [read-only]

Language version: ActionScript ActionScript 3.0
Runtime version: AIR 50.0

Property to check whether any loaded SWF has contained debug information.

This works by checking for the presence of a debugfile ActionScript instruction.

Implementation
    public static function get containsDebugInfo():Boolean
freeMemoryproperty 
freeMemory:Number  [read-only]

Language version: ActionScript 3.0
Runtime version: AIR 2

The amount of memory (in bytes) that is allocated to Adobe® Flash® Player or Adobe® AIR® and that is not in use. This unused portion of allocated memory (System.totalMemory) fluctuates as garbage collection takes place. Use this property to monitor garbage collection.

Implementation
    public static function get freeMemory():Number

See also

imeproperty 
ime:IME  [read-only]

Language version: ActionScript 3.0
Runtime version: 

The currently installed system IME. To register for imeComposition events, call addEventListener() on this instance.

Implementation
    public static function get ime():IME

See also

poisonStringsproperty 
poisonStrings:Boolean  [write-only]

Language version: ActionScript 3.0
Runtime version: AIR 33.1

Sets a flag to poison the memory used by any String object when it is garbage collected.

This can be used to protect passwords from being viewed via a memory dump of the AIR process.

Any string that is created whilst the flag is set to true will then have its contents set to 0xDD immediately upon its garbage collection (which should ideally be handled by reference counting). The value of this setting at the time of the String creation is retained so this setting can be turned off once a password has been entered, even if the string is not yet garbage collected.

Implementation
    public function set poisonStrings(value:Boolean):void
privateMemoryproperty 
privateMemory:Number  [read-only]

Language version: ActionScript 3.0
Runtime version: AIR 2

The entire amount of memory (in bytes) used by an application. This is the amount of resident private memory for the entire process.

AIR developers should use this property to determine the entire memory consumption of an application.

For Flash Player, this includes the memory used by the container application, such as the web browser.

Implementation
    public static function get privateMemory():Number

See also

totalMemoryproperty 
totalMemory:uint  [read-only]

Language version: ActionScript 3.0
Runtime version: 

The amount of memory (in bytes) currently in use that has been directly allocated by Flash Player or AIR.

This property does not return all memory used by an Adobe AIR application or by the application (such as a browser) containing Flash Player content. The browser or operating system may consume other memory. The System.privateMemory property reflects all memory used by an application.

If the amount of memory allocated is greater than the maximum value for a uint object (uint.MAX_VALUE, or 4,294,967,295), then this property is set to 0. The System.totalMemoryNumber property allows larger values.

Implementation
    public static function get totalMemory():uint

See also

totalMemoryNumberproperty 
totalMemoryNumber:Number  [read-only]

Language version: ActionScript 3.0
Runtime version: AIR 2

The amount of memory (in bytes) currently in use that has been directly allocated by Flash Player or AIR.

This property is expressed as a Number, which allows higher values than the System.totalMemory property, which is of type int.

This property does not return all memory used by an Adobe AIR application or by the application (such as a browser) containing Flash Player content. The browser or operating system may consume other memory. The System.privateMemory property reflects all memory used by an application.

Implementation
    public static function get totalMemoryNumber():Number

See also

useCodePageproperty 
useCodePage:Boolean  [read-write]

Language version: ActionScript 3.0
Runtime version: 

A Boolean value that determines which code page to use to interpret external text files. When the property is set to false, external text files are interpretted as Unicode. (These files must be encoded as Unicode when you save them.) When the property is set to true, external text files are interpretted using the traditional code page of the operating system running the application. The default value of useCodePage is false.

Text that you load as an external file (using Loader.load(), the URLLoader class or URLStream) must have been saved as Unicode in order for the application to recognize it as Unicode. To encode external files as Unicode, save the files in an application that supports Unicode, such as Notepad on Windows.

If you load external text files that are not Unicode-encoded, set useCodePage to true. Add the following as the first line of code of the file that is loading the data (for Flash Professional, add it to the first frame):

System.useCodePage = true;

When this code is present, the application interprets external text using the traditional code page of the operating system. For example, this is generally CP1252 for an English Windows operating system and Shift-JIS for a Japanese operating system.

If you set useCodePage to true, Flash Player 6 and later treat text as Flash Player 5 does. (Flash Player 5 treated all text as if it were in the traditional code page of the operating system running the player.)

If you set useCodePage to true, remember that the traditional code page of the operating system running the application must include the characters used in your external text file in order to display your text. For example, if you load an external text file that contains Chinese characters, those characters cannot display on a system that uses the CP1252 code page because that code page does not include Chinese characters.

To ensure that users on all platforms can view external text files used in your application, you should encode all external text files as Unicode and leave useCodePage set to false. This way, the application (Flash Player 6 and later, or AIR) interprets the text as Unicode.

Implementation
    public static function get useCodePage():Boolean
    public function set useCodePage(value:Boolean):void

See also

Method detail
decryptBlob()method
public static function decryptBlob(data:Class, key:String = null):ByteArray

Language version: ActionScript ActionScript 3.0
Runtime version: AIR 50.0

Decrypts a built-in BinaryData blob into a byte array object.

AIR 51.0 introduces an optional key parameter so that developers can decrypt content that had been set up using a custom key. This key would have either been provided within the source code (via the AS3 compiler 'Embed' tag) or via the compiler command line. If no custom key had been provided, a key is generated and embedded into the data stream, but please note this is not a secure method and has been reverse engineered. It it strongly recommended to use a custom key when compiling the SWF, and to obtain this key securely from a remote server at run-time, or similar, in order to provide it here for asset decryption.

Once the data has been used, it is recommended to wipe the resulting ByteArray object using the ByteArray.writeRandomBytes() method.

Parameters
data:Class — Class definition for the embedded data with encryption
 
key:String (default = null) — Custom key to use when decrypting

Returns
ByteArray — ByteArray containing the decrypted data
disposeXML()method 
public static function disposeXML(node:XML):void

Language version: ActionScript ActionScript 3.0
Runtime version: AIR 1.5.2

Makes the specified XML object immediately available for garbage collection. This method will remove parent and child connections between all the nodes for the specified XML node.

Parameters
node:XML — XML reference that should be made available for garbage collection.
error()method 
public static function error(errString:String):void

Language version: ActionScript ActionScript 3.0
Runtime version: AIR 33.1

Output a string to the console via 'stderr'. This method is intended for use by command-line AIR applications to display error messages to the user.

Parameters
errString:String — String to be displayed to the user via the stderr stream.
exit()method 
public static function exit(code:uint):void

Language version: ActionScript ActionScript 3.0
Runtime version: 

Closes Flash Player.

For the standalone Flash Player debugger version only.

AIR applications should call the NativeApplication.exit() method to exit the application.

Parameters
code:uint — A value to pass to the operating system. Typically, if the process exits normally, the value is 0.

See also

gc()method 
public static function gc():void

Language version: ActionScript ActionScript 3.0
Runtime version: 

Forces the garbage collection process.

For the Flash Player debugger version and AIR applications only. In an AIR application, the System.gc() method is only enabled in content running in the AIR Debug Launcher (ADL) or, in an installed applcation, in content in the application security sandbox.

input()method 
public static function input():String

Language version: ActionScript ActionScript 3.0
Runtime version: AIR 33.1

Request a string input from the user via the console. This method is intended for use by command-line AIR applications to request input from the user. Note that there is a 1024-character limit to the input string buffer.

Returns
String — String that the user entered via the console (stdin).
output()method 
public static function output(outString:String):void

Language version: ActionScript ActionScript 3.0
Runtime version: AIR 33.1

Output a string to the console via 'stdout'. This method is intended for use by command-line AIR applications to display normal messages to the user.

Parameters
outString:String — String to be displayed to the user via the stdout stream.
pause()method 
public static function pause():void

Language version: ActionScript ActionScript 3.0
Runtime version: 

Pauses Flash Player or the AIR Debug Launcher (ADL). After calling this method, nothing in the application continues except the delivery of Socket events.

For the Flash Player debugger version or the AIR Debug Launcher (ADL) only.

See also

pauseForGCIfCollectionImminent()method 
public static function pauseForGCIfCollectionImminent(imminence:Number = 0.75):void

Language version: ActionScript 3.0
Runtime version: AIR 3

Advise the garbage collector that if the collector's imminence exceeds the function's imminence parameter then the collector should finish the incremental collection cycle.

The Flash Runtime garbage collector algorithm runs incrementally while marking memory in use. It pauses application execution when collecting unused portions of memory. The pause that occurs as the incremental collection cycle finishes can be longer than desired and can be observable or audible in some programs. This function allows the application to advise the runtime that it is a good time to both complete the marking and perform collection. Scheduling potential pauses for times when the user won't notice them makes for a better user experience. For example, a game might call this function upon the completion of a level in a game, thus reducing the chances of a pause occurring during gameplay.

Imminence is defined as how far through marking the collector believes it is, and therefore how close it is to triggering a collection pause. The imminence argument to this function is a threshold: the garbage collector will be invoked only if the actual imminence exceeds the threshold value. Otherwise, this call returns immediately without taking action.

By calling this function with a low imminence value, the application indicates that it is willing to accept that a relatively large amount of marking must be completed. A high imminence value, on the other hand, indicates that the application should be paused only if marking is nearly complete.  Typically, pauses are longer in the former case than in the latter.

The amount of memory being freed does not depend on the imminence parameter. It only depends on the number of freeable objects. If the application has recently released references to large data structures or to a large number of objects, a low imminence parameter will tend to trigger a collection that will free those objects immediately.

Parameters
imminence:Number (default = 0.75) — A number between 0 and 1, where 0 means less imminent and 1 means most imminent. Values less than 0 default to 0.25. Values greater than 1.0 default to 1.0. NaN defaults to 0.75
resume()method 
public static function resume():void

Language version: ActionScript ActionScript 3.0
Runtime version: 

Resumes the application after calling System.pause().

For the Flash Player debugger version or the AIR Debug Launcher (ADL) only.

See also

setClipboard()method 
public static function setClipboard(string:String):void

Language version: ActionScript 3.0
Runtime version: 

Replaces the contents of the Clipboard with a specified text string. This method works from any security context when called as a result of a user event (such as a keyboard or input device event handler).

This method is provided for SWF content running in Flash Player 9. It allows only adding String content to the Clipboard.

Flash Player 10 content and content in the application security sandbox in an AIR application can call the Clipboard.setData() method.

Parameters
string:String — A plain-text string of characters to put on the system Clipboard, replacing its current contents (if any).

See also

Examples
examples\SystemExample
The following example shows how to copy information about your system's total memory to the system Clipboard using a call to System.totalMemory within a call to the System.setClipboard() method.
package {
    import flash.display.Sprite;
	import flash.system.System;

	public class SystemExample extends Sprite {
		public function SystemExample() {
			System.setClipboard("System.totalMemory: " + System.totalMemory);
		}
	}
}