ActionScript 2.0 Class Locations
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