Flash CS5 – 5005: Unknown error optimizing byte code

A quick post, as this issue has been covered in massive amounts of detail over at negush.net but this really is a doozy!

Basically, if you have a LOT of code and/or library files being compiled into your project and then… poof… Flash drops this crazy error:

,line 1: Error 5005: Unknown Error optimizing byte code

OK… what?
If you try and ask Flash for more details, it tells you there aren’t any.  Wonderfully useful.

For us, it was adding the Bamboo SDK files (a pair of SWC libraries) to an already hefty project, that pushed the compiler over the edge.
But, fear not, for there IS A SOLUTION!

There are many suggestions in the link provided, but the one that worked for us was to add an environment variable to the operating system:
Value: -Xmx1024M
Then reboot your PC – that should allow the environment variable to take affect.

This is telling/allowing the Java Virtual Machine to use up to 1GB of system RAM to perform any single operations… or something to that effect.  Open up Flash (in our case, Pro CS5) and compile the troublesome project.
Et voila.  It works!