# Understanding the classpath

In order to use a class or interface that you've defined, Flash must be able to locate the external AS files that contains the class or interface definition. The list of folders that Flash searches for class and interface definitions is called the classpath.

When you create an ActionScript class file, you need to save the file to one of the folders specified in the classpath, or a subfolder therein. Equivalently, you can modify the classpath to include the desired folder path. Otherwise, Flash won't be able to resolve, or locate, the class or interface specified in the script. Subfolders that you create within a classpath folder are called packages, and let you organize your classes. For more information on using packages see Using packages.

## Global and document-level classpaths

Flash actually has two classpath settings: a global classpath and a document-level classpath. The global classpath applies to both external ActionScript (AS) and FLA files. The document-level classpath applies to individual Flash (FLA) file and is not available for external script files.

The global classpath is set using the Preferences (File > Preferences) dialog. The document-level classpath is set on the Flash tab of the Publish Setting dialog. For more information on modifying the classpath, see Modifying the classpath.

By default, the global classpath contains two folder paths: a relative path that points to the folder that contains the current document, and the \Classes folder located in the per-user configuration folder installed with Flash. The location of this folder is shown below for both Windows and Macintosh platforms.

- Windows: C:\documents and settings\userName\application data\macromedia\flash mx2\language\configuration\Classes\
- Macintosh: MacintoshHD:Users:userName:Library:Application Support:Macromedia:Flash MX2:language:Configuration:Classes\

The document-level classpath, by default, is empty.

When Flash attempts to resolve class references in a FLA script, it first searches the document-level classpath specified for that FLA. If the class is not found in the classpath, or if the classpath is empty, then Flash searches the global classpath. If the class is not found in the global classpath, than a compiler error occurs.

Flash uses the global classpath to resolve references to classes when performing a Check Syntax or Auto Format operation in external AS scripts or FLA scripts, or during a Publish or Test Movie operation on FLA files.