Flash – Add Path to Your Classes – AS3 Classpath

When using Flash regularly, as with any other software, there are tasks repeating in many projects over and over again. To speed up this process, it just makes sense creating your own classes and functions and having them available for all projects to use.

So how do we do this?
In order to have a class accessible to all flash projects, we need to add a location (a folder on your computer where you’ll store your classes) to the Source Path.

Go to Flash > Preferences, (this is based on Mac OS X & Flash CS4) and you will get a Preferences window. In the left column select Actionscript.

as3 classpath

At the bottom of the window you will see 2 buttons Actionscript 2.0 Settings and Actionscript 3.0 Settings.
Click on Actionscript 3.0 Settings if you’re using AS3 for your projects.

flash classpath

In the Source Path area click on the “folder” icon (Browse to Path) and locate a folder on your computer where you’ll be storing your classes available to all projects.

as3 source path

And that’s it, now you can use these classes within your projects by importing them like so:

	import moonpixel.net.*;

Which would import all classes within “net” folder which is within “moonpixel” folder which is within your folder you specified in the Source Path.

  • We looked whole internet to findcomments regarding to this field…. Thanks alot

  • At the bottom of the window you will see 2 buttons Actionscript 2.0 Settings and Actionscript 3.0 Settings.

  • Coolbuddyroolz

    i have a problem doing this in Adobe Flash CS5