This costed me abut 4 hours of my life. Please tell me, what's going on (AS2, Flash CS4).
Here's the test code:
private var a:Array = ;
public function test()
public function addItem()
var it1 = new InitTest();
var it2 = new InitTest();
// End of test code
Why on earth the private property a is already populated, when the second instance is initialized? The array property is now shared between the instances, like a static property. If I'd add to test code
Ok, I now found out that if I leave just private var a:Array; in the declaration and do a = ; in the constructor, this works as expected. But what' s the problem with the test code above?
there's nothing wrong with your code. that's an array class bug.
Wow, thanks! How could I know, has this bug been documented somewhere loudly enough?
Is the bug in the SWF bytecode generated by Flash CS4, or rather in the bytecode that is embedded in the Flash Player? If it's the latter, perhaps one can expect bugfix soon!
the bug's been known for years. i wouldn't expect a fix soon.
check the online as2 help files. someone posted a message pointing out the bug and an adobe rep responded.