Flash MX 2004's Classpath for Dummies
A quick introduction to the Actionscript Classpath for non-coders. 2005-01-12
And when I say Dummies, I generally mean people who will be required to install
code that aren't coders themselves.
What is a classpath? It is a folder that you keep all your ActionScript classes
in.
Setting Up The Classpath
1. First, we're going to create a folder to put our classes in. Create a new
folder on your hard drive and call it MyClasses.

2. In Flash MX 2004 go Edit->Preferences and click on the
ActionScript tab.

3. Then click on the ActionScript 2.0 Settings button.

4. Now click on the crosshairs and navigate to the MyClasses folder. It will
be added to the classpath.
You've now set up what's known as a classpath.
Adding Code to The Classpath
When given code to put in a classpath, it generally is a zip file with a directory
in it. And another directory in that one. And another in that one. And then
finally at the end are a bunch of .as files. Don't try to figure out why its
like this. Simply unzip, then take the root folder and place it in the MyClasses
folder. That's it. Flash will automagically see the ActionScript, and include
it for export inside your swf file.
Things Not To Do
Just use one classpath. Keep all your classes in one centralized location.
Don't put it in the same directory as your project! This can lead to big headaches
down the road.
Don't mess with the directory structure! The files must stay in the directories
they're in.
Don't put the directory on a networked drive unless you know what you're doing.
If you have to do this, make sure you have the newest Flash updates installed,
and that the clocks of all computers are in sync.
A Quick Example: XPath
A good example to use is XPath
For ActionScript. Download
the classes and unzip them to the classpath. Voila! Your directory structure
should look like this:

That's all you really need to know about classpaths. Happy compiling!!
|