create a new fla that contains nothing, save it and test it. if no problem, gradually add the assets from your problematic fla until you pinpoint the problem.
I have been doing this. Even if I creat a new image in Illustrator, then import a new low res image, the errors start.
Typically you get '5005: Unknown error optimizing byte code' message in Flash-based applications made up of thousands of lines of code, numerous large objects, or a great number of small classes. You can fix this by increasing the Java VM memory which I think you have already done. The ReferenceError: Error #1065 occurs when you do not declare your class as public. Private classes can not be used as document classes because they are out of the class package and therefore are not a part of the private scope. Try this out and see if it helps.