“Private” classes might cause a compile error
BeInteractive! (blog written by Yoshihiro Shindo) reported a bug of “private” classes (defined outside of the package block). Two or more “private” classes might cause a compile error, which tells that a local variable declared in a main class (inside the package) is undefined in Flash CS4 Professional.
1120: Access of undefined property s.

Compile error #1120
I found another condition of the error. If a “private” class inherits a class other than Object the compile error will be prevented.
package {
import flash.display.Sprite;
public class PrivateClassIssue extends Sprite {
public function PrivateClassIssue() {
var s:String = 'hello';
trace(s);
}
}
}
class Foo {}
class Bar extends Array {} // inherits Array class
5 Comments
what sdk do you use to compile? i’m on 4.0.0.4065 and there is no problem.
oh wait, it’s CS4, isn’t it… whatever then, flash compiler sucked for a long time now.
Right. It is Flash CS4 Professional. I added the information to my article. Thank you for giving me the heads up, makc.
I’m not sure, but if you put the classes into de package, what happen?
Thank you for your comment, dumps. And I am sorry for replying too late.
According to the [Help], “only one class in each file can be declared inside a package declaration”. “You must declare any additional classes outside your package definition”.
http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7f9e.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7f93
If I remember correctly, the alpha version of ActionScript 3.0 once allowed to define “private” classes inside a package declaration, though.