After I got the Flash unknown error optimizing byte code, my game file wasn't the same anymore... Even doing the "memory fix" (change the jvm.ini file to 512), I've got two others strange errors... and at rare times the same "Flash unknown error optimizing byte code"
First error "reference not found" - I had a lot of as3 classes that flash generates automatically for me, like bitmaps and sounds. When you try to set up the "export for actionscript 3" Flash gives this warn to you:
But flash wasn't generating these classes...and after some other compiles, I've got the second error.
Second "NO error" - How can a "no error" be an error? Ok I know this is strange BUT Flash don't give to you an error! it compiles your project but the .swf file size is smaller than before and no as3 code is being executed, even if I trace something or try to force an error, nothing happen! My close and open flash trick is not working anymore, so... time to try new things!
Things that I tried to solve my problem:
- Remove all your library content from the folders, place it at your library root: Ok 478 items at the root of the library, some with a name Copy on the end because of their duplicated name...BUT it worked only for a few compiles! =(
- Save file as CS4 and later save file as CS5: Some say that this is because of the way .fla works if you save as CS4 you will "clean" something...but for me this haven't worked =/
- Control > Delete ASO files, didn't worked.
- Change the publish settings a little: I have changed them a little, saved the file, tried to compile and later changed it again to the initial values...again worked only for a few compiles! =(
- Create a totally new .FLA file! I was expecting that this would fix my problem, so I created a new empty .FLA file...copied every library file to it and my scenes...again worked only for a few compiles! =(
- AS3 constants - I noticed that my CONFIG::FLASH_AUTHORING constant was not there at AS3 settings... so I've tried to put it again, but didn't work.
- THE SOLUTION - Finally the real fix for my problems...ok maybe is the new file + no folders at the library + save as CS4 and save back to CS5 + replace the as3 constant, but whatever, I have changed this AS3 library path setting below:
Instead of "Runtime shared library (RSL)" put "Merged into code" and IT WORKED!!! more than a few compiles!!!
I Hope this will be useful to someone... =)
Special Thank to these sources:
Kirupa forum 2008 for CS4, but we know that there is a lot of CS4 on CS5, so I had to give a try
Stackoverflow compiling fla with huge internal library (thanks Philippe for the answer)