var myTest:test1 = new test1();
now, if you try to compile this code you get an error - "The
private and cannot be accessed." - makes sense. however, if
in the second
line, you put -
var myTest = new test1()
without the type-casting, voila - no compile error, and the
value is traced.
moreover, if you leave the second line as is, and add the
(after removing the first trace line so it will be compiled)
again - no compile error, and the private var's value is
if that's so - what's the deal with private vars?
thanks in advance,
Essentially, this is just how the compiler works in AS2. If
you don't enable
strict checking, by typing your variables, the compiler won't
checks. I believe, since there is runtime type checking in
player 9 / AS3,
this would work as expected - and fail.