Flash CS4 Professional ActionScript 2.0

About top-level and built-in classes

In addition to the ActionScript core language elements and constructs (for and while loops, for example) and primitive data types (numbers, strings, and Booleans) described earlier in this manual (see Data and Data Types and Syntax and Language Fundamentals), ActionScript also provides several built-in classes (complex data types). These classes provide a variety of scripting features and functionality. You have used top-level classes and other built-in classes that are part of the ActionScript language in earlier chapters, and you will use them throughout the remaining chapters. There are many classes that ship with Flash that you use to create interactivity and functionality in your SWF files, and you can even build complex applications using them. For example, you can use the Math class to perform equations in your applications. Or you might use the BitmapData class to create pixels and scripted animations.

Top-level classes, listed in Top-level classes, are written into Flash Player. In the Actions toolbox, these classes are located in the ActionScript 2.0 Classes directory. Some of the top-level classes are based on the ECMAScript (ECMA-262) edition 3 language specification and are called core ActionScript classes. Examples of core classes are the Array, Boolean, Date, and Math classes. For more information on packages, see Working with packages.

You can find the ActionScript classes installed on your hard disk. You can find the classes folders here:

  • Windows: Hard Disk\Documents and Settings\user\Local Settings\Application Data\Adobe\Flash CS3\language\Configuration\Classes.

NOTE

 

In Windows, the Application Data folder is hidden by default. To show hidden folders and files, select My Computer to open Windows Explorer, select Tools>Folder Options and then select the View tab. Under the View tab, select the Show hidden files and folders radio button.

  • Macintosh: Hard Disk/Users/user/Library/Application Support/Adobe/Adobe Flash CS3/language/Configuration/Classes.

Do note the Read Me document located in this directory for more information about its structure.

To understand the distinction between core ActionScript classes and those specific to Flash, consider the distinction between core and client-side JavaScript. The client-side JavaScript classes provide control over the client environment (the web browser and web page content), and the classes specific to Flash provide runtime control over the appearance and behavior of a Flash application.

The rest of the built-in ActionScript classes are specific to Flash and the Flash Player object model. Examples of these classes are the Camera, MovieClip, and LoadVars classes. Other classes are organized into packages, such as flash.display. All of these classes are sometimes referred to as built-in classes (predefined classes that you can use for adding functionality to your applications).

The following sections introduce the built-in ActionScript classes, and describe the fundamental tasks you perform with these built-in classes. For an overview of working with classes and objects in object-oriented programming, see About working with built-in classes. Code examples using these classes are included throughout this manual.

For information on language elements (such as constants, operators, and directives), see Syntax and Language Fundamentals.

For more information on top-level and built-in classes, see the following topics:

Other language elements

There are other language elements that make up ActionScript, outside of classes. These include directives, constants, global functions, global properties, operators, and statements. For information on how to use each of these language elements, see the following topics:

You can find a list of these language elements in the following sections of the ActionScript 2.0 Language Reference:

  • Compiler Directives
  • Constants
  • Global Functions
  • Global Properties
  • Operators
  • Statements