Sunday, August 17, 2008

Strange AS3/Flash 9 behavior with regards to classpath

By:
The other day I was creating a new code branch for a project I'm working on and discovered that certain .FLAs would not compile correctly after I copied over the branch of code into a new folder. The SWF in question would build, but it would be caught in a visual loop that normally means an error occurred during compilation, but no compiler error trace was available.

Turns out that for the .FLA in question, the classpath I was using was relative "../" since I was using a typical project layout structure:

_game/
...../fla
...../bin
...../com

etc.

"../" for the compiled .SWF would put the classpath at _game/, making the com subdirectory available.

Once I changed this classpath to be absolute for the newly created path for the copy of the project, the .FLA in question compiled properly.

I'm not sure why only certain .FLAs were affected, but this fixed my issue.

Update: 1:19PM

If I change the classpath to be 2 levels above and then point to the top level folder for the source, it also fixes the issue without having to rely on absolute paths:

"../../_game" instead of the original "../".

Very strange indeed.

0 comments: