Hey Sebastian,

Mark them as static if you want the one array to be shared across all
instances.

private static var myArray:Array = [1,2,3];

=) Mike

Mike Pearce
[EMAIL PROTECTED]
http://www.nectarine.com.au



----- Original Message -----
From: "Sebastian Porto" <[EMAIL PROTECTED]>
To: "Flash Developers List" <[EMAIL PROTECTED]>
Sent: Wednesday, July 21, 2004 9:09 AM
Subject: [fugli] Mysterious shared array



Hi all
I have a problem when using arrays in my classes
I don't know why the arrays are being shared between multiple instances
of a class even if I declare them as private. Below is a simple example.
Any help is much appreciated.

Thanks
Sebastian

//in One.as:
class One{
private var arr:Array=[0];

public function One(){
arr[0]++;
trace(arr[0]);
}
}



//In a fla file:
o1=new One();
o2=new One();
o3=new One();

stop();


//output:
1
2
3


---
You are currently subscribed to fugli as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/



---
You are currently subscribed to fugli as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to