Globally Linked Classpaths

In my last post, I discussed how to link folders of classes to individual projects in both FlashDevelop and Flash Professional CS5.  There are certain things you can’t live without in a project, however.  Everyone has a class or two that they import into every project for functions they use themselves or an engine they use all the time.  When this happens, Global Classpaths come in handy.

Today, I will briefly discuss advantages and disadvantages of using global classpaths, and how to create a global classpath in both Flash Professional CS5 and FlashDevelop.

Using a global classpath, every project you create will automatically be linked, saving you both time and frustration later.  This will allow you to import classes without having copy directories into your project’s folder or link the directory to the projects individually through the classpaths menu.

However, there are a couple drawbacks to using a global classpath for your projects, mainly if you choose to move to a different computer, your classpaths won’t be mapped the same, so you might have to remap them.  The other is that sometimes you might not want them imported.  If this last situation crops up, you might want to reconsider what you have in your global classpaths!

To start, make sure you have a directory somewhere on your machine where you can store all of the classes you plan on linking.  Next, open FlashDevelop and go to the Project menu and select Properties.  Under the Classpaths tab, there is an “Edit Global Classpaths” button.  If you enter that menu, you will see a list of current Global classpaths you have.  Click on the Add classpath button and navigate to the directory where you are storing the libraries you want to link globally.  Click OK and it’s done!  If you change your mind, you can always use this menu to remove any currently linked classpaths you have.

To link the same to the same Global Classpath in Flash Professional, go to the Edit menu and select Preferences (Or hit CTRL+U).  This will open a window that lets you adjust many aspects of the Flash IDE.  If you go under the ActionScript category, there will be a button close to the bottom labeled ActionScript 3.0 Settings that you should click.  This will open a window that allows you to link classpaths and SWCs.  Under the Source path section, click on the folder icon and navigate to the directory you set up.  When it’s selected, hit OK a few times and you’re all set up!  All of your AS3 FLA files will be able to see any classes inside of your globally linked directory.

Comments are closed.