Basics of the client system environment
Introduction to the client system environment
As you build more advanced ActionScript applications, you may find a need to know details about--and access functions of--your users' operating systems. The client system environment is a collection of classes in the flash.system package that allow you to access system-level functionality such as the following:
- Determining which application and security domain a SWF is executing in
- Determining the capabilities of the user's Flash Player, such as the screen size (resolution) and whether certain functionality is available, such as mp3 audio
- Building multilingual sites using the IME
- Interacting with the Flash Player's container (which could be an HTML page or a container application)
- Saving information to the user's clipboard
The flash.system package also includes the IMEConversionMode and SecurityPanel classes. These classes contain static constants that you use with the IME and Security classes, respectively.
Common client system environment tasks
The following common tasks for working with the client system using ActionScript are described in this chapter:
- Determining how much memory your application is using
- Copying text to the user's clipboard
- Determining capabilities of the user's computer, such as:
- Screen resolution, color, DPI, and pixel aspect ratio
- Operating system
- Support for streaming audio, streaming video, and mp3 playback
- Whether the installed Flash Player is a debugger version
- Working with application domains:
- Defining an application domain
- Separating SWF files' code into application domains
- Working with an IME in your application:
- Determining whether an IME is installed
- Determining and setting the IME conversion mode
- Disabling the IME for text fields
- Detecting when IME conversion happens
Important concepts and terms
The following reference list contains important terms used in this chapter:
- Operating system: The main program that runs on a computer, within which all other applications run--such as Microsoft Windows, Mac OS X, or Linux®.
- Clipboard: The operating system's container for holding text or items that are copied or cut, and from which items are pasted into applications.
- Application domain: A mechanism for separating classes used in different SWF files, so that if the SWF files include different classes with the same name, the classes don't overwrite each other.
- IME (input method editor): A program (or operating system tool) that is used to enter complex characters or symbols using a standard keyboard.
- Client system: In programming terms, a client is the part of an application (or whole application) that runs on an individual's computer and is used by a single user. The client system is the underlying operating system on the user's computer.
Working through in-chapter examples
As you're working through the chapter, you may want to test some of the example code listings for yourself. All the code listings in this chapter include the appropriate trace() function call for writing out the values being tested. To test the code listings in this chapter:
- Create an empty Flash document.
- Select a keyframe in the timeline.
- Open the Actions panel and copy the code listing into the Script pane.
- Run the program using Control > Test Movie.
You will see the results of the code listing's trace() functions in the Output panel.
Some of the later code listings are more complex and are written as a class. To test these examples:
- Create an empty Flash document and save it to your computer.
- Create a new ActionScript file and save it in the same directory as the Flash document. The file's name should match the name of the class in the code listing. For instance, if the code listing defines a class named SystemTest, use the name SystemTest.as to save the ActionScript file.
- Copy the code listing into the ActionScript file and save the file.
- In the Flash document, click a blank part of the Stage or work space to activate the document Property inspector.
- In the Property inspector, in the Document Class field, enter the name of the ActionScript class you copied from the text.
- Run the program using Control > Test Movie
You will see the results of the example in the Output panel.
Techniques for testing example code listings are described in more detail in Testing in-chapter example code listings.