PackageTop Level
Classpublic class System
InheritanceSystem Inheritance Object

Player version: Flash Player 6

The System class contains properties related to certain operations that take place on the user's computer, such as operations with shared objects, local settings for cameras and microphones, and use of the Clipboard. The following additional properties and methods are in specific classes within the System package: the capabilities class, the security class, and the IME class.

See also

System.capabilities
System.security
System.IME


Public Properties
 Property
  exactSettings : Boolean
[static]A Boolean value that specifies whether to use superdomain (false) or exact domain (true) matching rules when accessing local settings (such as camera or microphone access permissions) or locally persistent data (shared objects).
  useCodepage : Boolean
[static]A Boolean value that tells Flash Player whether to use Unicode or the traditional code page of the operating system running the player to interpret external text files.
 Properties inherited from class Object
 __proto__, __resolve, constructor, prototype
Public Methods
 Method
  
setClipboard(text:String):Void
[static]Replaces the contents of the Clipboard with a specified text string.
  
showSettings([tabID:Number]):Void
[static]Shows the specified Flash Player Settings panel.
 Methods inherited from class Object
 addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch
Events
 EventSummaryDefined by
  
onStatus = function(infoObject:Object) {}
Event handler: provides a super event handler for certain objects.System
Property detail
exactSettingsproperty
public static var exactSettings:Boolean

Player version: Flash Player 7

A Boolean value that specifies whether to use superdomain (false) or exact domain (true) matching rules when accessing local settings (such as camera or microphone access permissions) or locally persistent data (shared objects). The default value is true for files published for Flash Player 7 or later, and false for files published for Flash Player 6.

If this value is true, the settings and data for a SWF file hosted at here.xyz.com are stored in a directory called here.xyz.com, the settings and data for a SWF file hosted at there.xyz.com are stored in a directory called there.xyz.com, and so on. If this value is false, the settings and data for SWF files hosted at here.xyz.com, there.xyz.com, and xyz.com are shared, and are all stored in a directory called xyz.com.

If some of your files set this property to false and others set it to true, you might find that SWF files in different subdomains share settings and data. For example, if this property is false in a SWF file hosted at here.xyz.com and true in a SWF file hosted at xyz.com, both files will use the same settings and data--namely, those in the xyz.com directory. If this isn't the behavior you want, ensure that you set this property in each file to correctly represent where you want to store settings and data.

If you want to change this property from its default value, do so in the first frame of your document. If you want to change this property from its default value, do so near the beginning of your script. The property can't be changed after any activity that requires access to local settings, such as System.showSettings() or SharedObject.getLocal().

If you use loadMovie(), MovieClip.loadMovie(), or MovieClipLoader.loadClip() to load one SWF file into another, all the files published for Flash Player 7 share a single value for System.exactSettings, and all the files published for Flash Player 6 share a single value for System.exactSettings. If you use MovieClip.loadMovie() or MovieClipLoader.loadClip() to load one SWF file into another, all of the files share a single value for System.exactSettings. Therefore, if you specify a value for this property in one file published for a particular Player version, you should do so in all the files that you plan to load. If you load multiple files, the setting specified in the last file that's loaded overwrites any previously specified setting.

Usually you should find that the default value of System.exactSettings is fine. Often your only requirement is that when a SWF file saves a shared object in one session, the same SWF file can retrieve the same shared object in a later session. This situation will always be true, regardless of the value of System.exactSettings. But you might want to change System.exactSettings from its default so that a SWF file published for Flash Player 7 or later can retrieve shared objects originally created by a SWF file published for Flash Player 6. Because the player has stored the shared objects created by the Flash Player 6 SWF file in a folder that's specific to the superdomain of that SWF file, you should use superdomain rules for shared object retrieval in your Flash Player 7 SWF file. This step requires specifying System.exactSettings = false in your Flash Player 7 SWF file. It is also possible that you might have SWF files that are published for Flash Player 6 and Flash Player 7 SWF files that share the same shared object data. In this case, simply pick a value for System.exactSettings (either true or false) and use it consistently in your Flash Player 6 and Flash Player 7 SWF files.

See also


Example
The following example shows how to specify superdomain matching rules:

useCodepageproperty 
public static var useCodepage:Boolean

Player version: Flash Player 6

A Boolean value that tells Flash Player whether to use Unicode or the traditional code page of the operating system running the player to interpret external text files. The default value of System.useCodepage is false.

Text that you load as an external file (using the loadVariables() or getURL() statements, or the LoadVars class or XML class) must be encoded as Unicode when you save the text file in order for Flash Player 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 2000.

If you load external text files that are not Unicode-encoded, you should set System.useCodepage to true. Add the following code as the first line of code in the first frame of the SWF file that is loading the data:

System.useCodepage = true;

When this code is present, Flash Player interprets external text using the traditional code page of the operating system running Flash Player. This is generally CP1252 for an English Windows operating system and Shift-JIS for a Japanese operating system. If you set System.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 System.useCodepage to true, remember that the traditional code page of the operating system running the player must include the characters used in your external text file in order for the text to display. 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 SWF files, you should encode all external text files as Unicode and leave System.useCodepage set to false by default. This way, Flash Player 6 and later interprets the text as Unicode.

Method detail
setClipboard()method
public static function setClipboard(text:String):Void

Player version: Flash Player 7 — SWF files published for Flash Player 6 or later, playing in Flash Player 7 or later.

Replaces the contents of the Clipboard with a specified text string.

Note: Because of security concerns, it is not possible to read the contents of the system Clipboard. In other words, there is no corresponding System.getClipboard() method.

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

Example
The following example places the phrase "Hello World" onto the system Clipboard:
System.setClipboard("Hello world");

The following example creates two text fields at runtime, called in_txt and out_txt. When you select text in the in_txt field, you can click the copy_btn to copy the data to the Clipboard. Then you can paste the text into the out_txt field.

this.createTextField("in_txt", this.getNextHighestDepth(), 10, 10, 160, 120);
in_txt.multiline = true;
in_txt.border = true;
in_txt.text = "lorum ipsum...";
this.createTextField("out_txt", this.getNextHighestDepth(), 10, 140, 160, 120);
out_txt.multiline = true;
out_txt.border = true;
out_txt.type = "input";

copy_btn.onRelease = function() {
    System.setClipboard(in_txt.text);
    Selection.setFocus("out_txt");
};

If your SWF file includes a version 2 component, use the version 2 components DepthManager class instead of the MovieClip.getNextHighestDepth() method, which is used in this example.

showSettings()method 
public static function showSettings([tabID:Number]):Void

Player version: Flash Player 6

Shows the specified Flash Player Settings panel. The panel lets users do any of the following actions:

For example, if your application requires the use of a camera, you can tell the user to select Allow in the Privacy Settings panel and then issue a System.showSettings(0) command. (Ensure that your Stage size is at least 215 x 138 pixels Ensure that your Flex screen size is at least 215 x 138 pixels; this is the minimum size Flash requires to display the panel.)

Parameters
tabID:Number [optional] — A number; a number that specifies which Flash Player Settings panel to display, as shown in the following table:

Value passed for panel Settings panel displayed
None (parameter is omitted) or an unsupported value The panel that was open the last time the user closed the Player Settings panel.
0 Privacy
1 Local Storage
2 Microphone
3 Camera

See also


Example
The following example shows how to display the Flash Player Settings Local Storage panel:

System.showSettings(1);

Event detail
onStatusevent handler

public onStatus = function(infoObject:Object) {}

Player version: Flash Player 6

Event handler: provides a super event handler for certain objects.

The LocalConnection, NetStream, and SharedObject classes provide an onStatus event handler that uses an information object for providing information, status, or error messages. To respond to this event handler, you must create a function to process the information object, and you must know the format and contents of the returned information object.

In addition to these specific onStatus methods, Flash also provides a super function called System.onStatus, which serves as a secondary error message handler. If an instance of the LocalConnection, NetStream, or SharedObject class passes an information object with a level property of "error", but you have not defined an onStatus function for that particular instance, then Flash uses the function you define for System.onStatus instead.

Note: The Camera and Microphone classes also have onStatus handlers but do not pass information objects with a level property of "error". Therefore, System.onStatus is not called if you don't specify a function for these handlers.

Parameters
infoObject:Object — A parameter defined according to the status message.

Example
The following example shows how to create a System.onStatus function to process information objects when a class-specific onStatus function does not exist:
// Create generic function
System.onStatus = function(genericError:Object){
    // Your script would do something more meaningful here
    trace("An error has occurred. Please try again.");
}

The following example shows how to create an onStatus function for an instance of the NetStream class:

// Create function for NetStream object

videoStream_ns.onStatus = function(infoObject:Object) {
    if (infoObject.code == "NetStream.Play.StreamNotFound") {
        trace("Could not find video file.");
    }
}

See also