
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Package Access and the Classpath
|
247
Adding a New Directory to the Classpath
If we want to store our Player.as class file in a directory other than the two included
by default in the global classpath (and /Configuration/Classes), we have to add the
package root directory to either the global classpath or the document classpath (i.e.,
the classpath specified by game.fla itself). For example, suppose we were to place
Player.as here:
C:\data\actionscript\com\yourdomain\game\Player.as
To give all .fla files access to the Player class, we’d add the directory C:\data\action-
script to the global classpath, as follows:
1. Select Edit
➝ Preferences ➝ ActionScript ➝ Language ➝ ActionScript 2.0 Settings.
2. Under Classpath, click the plus sign (+) to add a new classpath entry. A blank
entry appears.
3. In the classpath entry, type
C:\data\actionscript\. (Or use the crosshair button
to browse to that directory.)
4. Click OK to accept the ActionScript 2.0 settings.
5. Click OK to accept the new preferences.
Alternatively, if we were using the Player class only in game.fla, we could give game.fla
individual access to the Player class by adding the directory C:\data\actionscript to
game.fla’s own classpath, like this:
1. Open game.fla in Flash MX 2004.
2. Select File
➝ Publish Settings ➝ Flash ➝ ActionScript ...