Flash Player API Overview

This chapter describes the Adobe Flash Player 9 packages provided with the ActionScript 3.0 language.

The Flash Player API refers to all packages, classes, functions, properties, constants, events, and errors that are in the flash package. They are unique to Flash Player, as opposed to the top-level classes, such as Date, Math, and XML, or the language elements, which are based on ECMAScript. The Flash Player API contains features that you expect to find in object-oriented programming languages, such as the flash.geom package for geometry classes, as well as features specific to the needs of rich Internet applications, such as the flash.filters package for expressiveness and the flash.net package for handling data transmission to and from a server.

The Flash Player API in ActionScript 3.0 contains many new classes that allow you to control objects and data at a low level. The architecture of the language is completely new and more intuitive. For example, the API is organized into logical packages: the flash.display package contains all classes related to the visual display list in Flash Player; the flash.media package contains classes for working with audio and video; and flash.text contains classes for working with text in Flash Player applications.

This chapter provides a brief overview of each package and highlights the most important or commonly used classes and functions in the package. For detailed information about the classes or package-level functions, see the specific entry in the ActionScript 3.0 Language Reference.

Contents

flash.accessibility package
flash.display package
flash.errors package
flash.events package
flash.external package
flash.filters package
flash.geom package
flash.media package
flash.net package
flash.printing package
flash.profiler package
flash.system package
flash.text package
flash.ui package
flash.utils package
flash.xml package

flash.accessibility package

The flash.accessibility package contains classes for supporting accessibility in Flash content and applications. The Accessibility class manages communication with screen readers. The AccessibilityProperties class lets you control the presentation of Flash objects to screen readers and other accessibility aids. For more information, see the flash.accessibility package in the ActionScript 3.0 Language Reference.

flash.display package

The flash.display package contains the core classes that Flash Player uses to build visual displays and control objects on the display list, which contains all visual elements in a Flash Player application.

In ActionScript 2.0, nearly all visual elements were controlled by the MovieClip class or handled "behind the scenes" by Flash Player. Low-level control of objects was not available. In ActionScript 3.0, the API to control visual elements is defined more logically, by functionality and usage. The flash.display package includes the following classes:

For more information, see Display Programming and the flash.display package in the ActionScript 3.0 Language Reference.

flash.errors package

The flash.errors package contains error classes that relate to Flash Player-specific functionality, such as IOError (input/out error) and IllegalOperationError. In ActionScript 3.0, exceptions are the primary mechanism for reporting run-time errors. For more information, see Handling Errors and the flash.errors package in the ActionScript 3.0 Language Reference.

flash.events package

The flash.events package supports the new XML Document Object Model (DOM) event model and includes the EventDispatcher base class. Events include error events. Error events are used when errors are encountered during an asynchronous operation, such as a call to the Loader.load() method. For more information, see Handling Events and the flash.events package in the ActionScript 3.0 Language Reference.

flash.external package

The flash.external package contains only the ExternalInterface class, which was introduced in Flash Player 8 as a replacement for the fscommand() function. ExternalInterface enables communication between ActionScript and the Flash Player container--for example, an HTML page with JavaScript or a desktop application in which Flash Player is embedded. For more information, see Using the External API and the flash.external package in the ActionScript 3.0 Language Reference.

flash.filters package

The flash.filters package contains classes for bitmap filter effects that were introduced in Flash Player 8. Filters let you apply rich visual effects, such as blur, bevel, glow, and drop shadows, to display objects. The classes in the flash.filters package are BevelFilter, BlurFilter, DisplacementMapFilter, GlowFilter, GradientBevelFilter, and GradientGlowFilter. This package also includes classes that offer a more complicated and varied range of effects by letting you apply matrixes to individual pixel values: ColorMatrixFilter and ConvolutionFilter. For more information, see the flash.filters package in the ActionScript 3.0 Language Reference.

flash.geom package

The flash.geom package contains geometry classes, such as Point, Rectangle, and Matrix, to support the Bitmap class, as well as the bitmap caching property of display objects. It also contains the Transform and ColorTransform classes for manipulating color values. For more information, see Working with Geometry and the flash.geom package in the ActionScript 3.0 Language Reference.

flash.media package

The flash.media package contains classes for working with audio and video streams that are either prerecorded or that stream from the client computer that is running Flash Player. The Sound class and its supporting classes let you work with external MP3 files and streaming sound embedded in a SWF file. The Microphone class lets you capture audio from a microphone attached to the computer. The Camera and Video classes let you capture video from a video camera attached to the computer. The Video class also lets you work with prerecorded external FLV files. For more information, see the flash.media package in the ActionScript 3.0 Language Reference.

flash.net package

The flash.net package contains a variety of classes that handle the sending and receiving of data. Flash Player 9 can handle many kinds of data--raw binary data, XML, text, URL-encoded variables, and whole files that can be uploaded or downloaded. Data can be transmitted from a network server to the client computer that is running Flash Player, and vice-versa, or between two SWF files.

Central to the package are the URLLoader class and the URLRequest class. You use the URLLoader class to send variables in an object to a specified URL and to load variables at a specified URL into an object. The URLRequest class captures all the data in an HTTP request.

This package also contains package-level functions, such as navigateToURL() and sendToURL(), that you can use for simple operations that don't require much server interaction.

For more information, see Networking and Communication and the flash.net package in the ActionScript 3.0 Language Reference.

flash.printing package

This package contains classes for printing Flash-based content. For more information, see Printing and the flash.printing package in the ActionScript 3.0 Language Reference.

flash.profiler package

This package contains the showRedrawRegions() function, which can be useful for debugging code. For more information, see the flash.profiler package in the ActionScript 3.0 Language Reference.

flash.system package

The flash.system package contains classes that provide system-level functionality and let you get limited, specified information about the functions of the client computer running Flash Player. The Capabilities and IME classes let you determine certain hardware and software capabilities of the computer that is running Flash Player. Included in this package are classes pertaining to security: Security, SecurityDomain, and LoaderContext.

The flash.system package also contains the ApplicationDomain class. This class lets you partition your custom classes into separate application domains and to reuse definitions.

For more information, see Client System Environment and the flash.system package in the ActionScript 3.0 Language Reference.

flash.text package

This package provides classes to work with text fields, text formatting, fonts, anti-aliasing, text metrics, style sheets, and layout. Advanced anti-aliasing is available in Flash Player 9 through the TextFormat and TextRenderer classes. Various new methods in the TextField class let you get low-level details about text fields. For more information, see the flash.text package in the ActionScript 3.0 Language Reference.

flash.ui package

The flash.ui package provides classes that let you customize the user interface, specifically the mouse cursor, the computer keyboard, and the context menu. For more information, see the flash.ui package in the ActionScript 3.0 Language Reference.

flash.utils package

This package provides various utility classes, such as ByteArray, which lets you access and work with data on the byte level, and the Timer class, which lets you run code on a specified time sequence. This package also contains a number of package-level functions that can control the time delay or intervals in which ActionScript code is executed. For more information, see the flash.utils package in the ActionScript 3.0 Language Reference.

flash.xml package

The flash.xml package provides legacy XML support. Because of the introduction of the top-level E4X-compliant XML class, the legacy XML-related classes that are compatible with ActionScript 1.0 and 2.0 XML objects are in the flash.xml package. For more information, see Working with XML and the XML and XMLList packages in the ActionScript 3.0 Language Reference.


Flex 2.01

Take a survey


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flex/201/html/14_Flash_Player_API_Overview_171_1.html