25 July 2010
A package in Adobe Flash Professional is a mechanism for organizing ActionScript classes into namespaces. It is a strategy for developing modular code. ActionScript programmers use packages to organize .as classes belonging to the same category or providing similar functionality. A package typically contains the classes that are required for a specific feature in the SWF file.
A package provides a unique namespace for the types it contains. Classes in the same package can access each other's functions and code.
The Adobe Flash Player API classes are located in the flash.* packages. The Flash Player API refers to all packages, classes, functions, properties, constants, events, and errors that are in the flash.* package. These classes are unique to Flash Player, as opposed to the top-level classes—such as Date, Math, and XML—or the ActionScript language elements, which are based on ECMAScript.
package samples
{
public class SampleCode
{
public var sampleGreeting:String;
public function sampleFunction()
{
trace(sampleGreeting + " from sampleFunction()");
}
}
}
Other classes for ActionScript authoring are in the fl.* packages and include the ActionScript 3 component classes, the FLVPlayback component classes, a Locale class for multilanguage text, the ActionScript 3 Motion classes, and the ActionScript 3 Tween and Transition classes.
To learn more about writing packages, see the section titled Statements, keywords, and directives in the ActionScript 3 Reference.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License