ActionScript 2.0 Class Locations

By sgrosvenor

I was recently working on a project that required me to upgrade a whole bunch of code from AS1.0 to AS2.0, and whilst the task was simple enough it involved several class files and hundreds of properties, methods and subclasses.

There was also a requirement to alter the functionality of some of the functions, so I set about creating the external class files, and overhauling the code, popped the class files in the Flash MX 2004 ‘/Classes/ folder and set about making the alterations.

As there were many alterations, I needed to test the SWF from time to time, but the code changes in the class files were not propagating through to the compiled SWF. Very strange, so I restarted Flash MX 2004, recompiled the SWF, and the changes appeared.

Even stranger was the fact that if you deleted the .as files from the ‘/Classes/’ folder of the installation directory the SWF still compiled! I thought there was some pretty heavy caching going on here, so searched for copies of the .as files I had just deleted, and sure enough there was a copy in another directory. I made some simple alterations to the .as files and hey presto, I could make changes to the class files without having to restart Flash!

I remembered from the beta’s something about runtime locations of files being different for each user, so I bring this simple set of tips for using external classes to those who perhaps haven’t ventured into AS2.0 yet.

[Note] These tips are for Windows based computers, but you get the idea.

[Drive] = Installation Drive
[Username] = Your Logon Account
[Language] = Flash MX 2004 localization language (usually for International English it is ‘en’)

1. Don’t save your class files in the Flash MX 2004 installation directory

[Drive]:Program FilesMacromediaFlash MX 2004enFirst RunClasses

2. Be careful when saving your class files in the same folder as your FLA (I’ve had differing effectiveness results when editing the classes in this fashion), other people report success, whereas others report failure

3. DO save your class files to your Local Settings folder

[Drive]:Documents and Settings[Username]Local SettingsApplication DataMacromediaFlash MX 2004[Language]ConfigurationClasses

I’d be interesting in anyone developing AS2.0 projects on Mac OS’ to see if anyone else has encountered a similair situation

  • Thirteenva

    “Don’t save your class files in the same folder as your FLA”

    Actually we do this with all our projects and it works well with both windows and mac. We’ve found this to be the best solution for our projects which are stored in Visual SourceSafe.

  • Dominator

    “Don’t save your class files in the same folder as your FLA”

    It’s the opposite. Do save your class files in the same folder of your FLA file. So, if you have to move your folder to another PC, your project will compile fine.

  • sgrosvenor

    It’s a tricky one, saving the files in the same location as the FLA, can have very strange results on different machines, as when you are making edits to the class, these are not reflected when previewing then movie within Flash.

Get the latest in Front-end, once a week, for free.