Sorry for being away for awhile and just testing that out now. So yea...
WTF? I can't believe after my years of AS2 coding that it would have taken
me this long to notice.
Well, good thing for AS3.
// NOT SHARED
public var myArray:Array;
public function MyClass() {
myArray = [];
}
// SHARED
public var myArray:Array = new Array();
public function MyClass() {
}
Cheers,
Jesse
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Muzak
Sent: Wednesday, March 12, 2008 2:04 AM
To: Flash Coders List
Subject: Re: [Flashcoders] clean scripting
In AS2 it does (and has been discussed here in the past), in AS3 it doesn't.
----- Original Message -----
From: "Jesse Graupmann" <[EMAIL PROTECTED]>
To: "'Flash Coders List'" <[email protected]>
Sent: Wednesday, March 12, 2008 5:38 AM
Subject: RE: [Flashcoders] clean scripting
> 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
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders