I think you are missing the () in the constructor statement:
function myClass {
trace("myArray.length="+myArray.length)
}
Should be:
function myClass() {
trace("myArray.length="+myArray.length)
}
Nathan
http://www.nathanderksen.com
On Dec 29, 2005, at 12:30 PM, Judah Frangipane wrote:
It seems like Flash is creating static members out of public arrays
that are initialized in the class declaration. Can someone confirm
this? Is this not legal, is it implied behavior or a bug?
// create a class called myClass
class myClass {
// initialize the array in the declarations
var myArray:Array = new Array();
function myClass {
trace("myArray.length="+myArray.length)
}
function addToArray() {
myArray.push(10)
myArray.push(20)
}
}
// on the actions frame
import myClass
var a = new myClass();
a.addToArray();
a.addToArray();
a.addToArray();
var b = new myClass();
// trace outputs
myArray.length=0
myArray.length=3
Judah
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders