When declaring a global array public/private variable in a class, make sure you only call new Array() in the constructor like so:
class myClass{
private var __myArray:Array;
function myClass(){
__myArray = new Array();
}
}
NOT like this:
class myClass{
private var __myArray:Array = new Array();
function myClass(){}
}
If you declare array vars as above,__myArray in subsequent instantiations of myClass will contain the data from the first instantiation of myClass. Seem like a bug to me, but at least I now know not to declare variables like this again!
1 comment:
Really useful. Thank you very much
Post a Comment