Muzak, Maybe I missed something, but instance2 in your example has no data. Only static members can be shared across all instances - did you mean...
class MyClass { private static var myArray:Array = new Array(); public function addItem(item:Object) { MyClass.myArray.push(item); } public function get data():Array { return MyClass.myArray; } } regards, Jesse -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Muzak Sent: Tuesday, March 11, 2008 4:51 PM To: Flash Coders List Subject: Re: [Flashcoders] clean scripting Allthough the following no longer seems to apply in AS3, it might be good to know. In AS2, if you have the following class: class MyClass { private var myArray:Array = new Array(); public function addItem(item:Object) { myArray.push(item); } public function get data():Array { return myArray; } } The myArray class member will be shared across ALL instances of the class. var instance1:MyClass = new MyClass(); var instance2:MyClass = new MyClass(); instance1.addItem("Hello World"); trace(instance1.data); trace(instance2.data); //output: Hello World Hello World regards, Muzak _______________________________________________ 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