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

Reply via email to