User Guide

434 Client System Environment
Getting data about the user’s system at runtime
By checking the System.totalMemory property, you can determine the amount of memory
(in bytes) that Flash Player is currently using. This property allows you to monitor memory
usage and optimize your applications based on how the memory level changes. For example, if
a particular visual effect causes a large increase in memory usage, you may want to consider
modifying the effect or eliminating it altogether.
The
System.ime property is a reference to the currently installed Input Method Editor
(IME). This property allows you to listen for
imeComposition events
(
flash.events.IMEEvent.IME_COMPOSITION) by using the addEventListener() method.
The third property in the System class is
useCodePage.When useCodePage is set to true,
Flash Player uses the traditional code page of the operating system that is running the player
to load external text files. If you set this property to
false, you tell Flash Player to interpret
the external file as Unicode.
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 English
Windows code page because that code page does not include Chinese characters.
To ensure that users on all platforms can view the external text files that are 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.
Saving text to the Clipboard
The System class includes a method called setClipboard() that allows Flash Player to set the
contents of the users Clipboard with a specified string. For security reasons, there is no
Security.getClipboard() method, since such a method could potentially allow malicious
sites to access the data last copied to the user’s Clipboard.
The following code illustrates how an error message can be copied to the user’s Clipboard
when a security error occurs. The error message can be useful if the user wants to report a
potential bug with an application.
private function securityErrorHandler(event:SecurityErrorEvent):void
{
var errorString:String = "[" + event.type + "] " + event.text;
trace(errorString);
System.setClipboard(errorString);
}