RE: [Flashcoders] Copy Constructor

2006-11-06 Thread Mike Keesey
-Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Paul Steven Sent: Saturday, November 04, 2006 2:39 AM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Copy Constructor Couldn't quite figure out your code Mike so have just

RE: [Flashcoders] Copy Constructor

2006-11-04 Thread Paul Steven
] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Paul Steven Sent: Friday, November 03, 2006 10:44 AM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Copy Constructor I think the problem may be that I am recursively creating the copies. Here are the two classes in full if anyone

RE: [Flashcoders] Copy Constructor

2006-11-03 Thread Paul Steven
PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Keesey Sent: 02 November 2006 22:53 To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Copy Constructor I might do it like this: class mypackage.Connect4State extends Object { public function Connect4State(state:Connect4State

RE: [Flashcoders] Copy Constructor

2006-11-03 Thread Paul Steven
/Connect4State.as Thanks Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Steven Sent: 03 November 2006 17:55 To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Copy Constructor Seem to be having problems with this still. It seems like every time

RE: [Flashcoders] Copy Constructor

2006-11-03 Thread Paul Steven
. Could really do with some help on this one. Thanks Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Steven Sent: 03 November 2006 18:44 To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Copy Constructor I think the problem may be that I am

RE: [Flashcoders] Copy Constructor

2006-11-03 Thread Paul Steven
] On Behalf Of Paul Steven Sent: 03 November 2006 19:14 To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Copy Constructor Doing a trace I can see the copies are being affected as if they are references. I was under the impression that array.concat() made a unique copy of an array

RE: [Flashcoders] Copy Constructor

2006-11-03 Thread Steven Sacks | BLITZ
Are these copies essentially just pointers to the same array? Yes. You need to clone the objects/arrays, not just set pointers. var newArray:Array = []; var i:Number = oldArray.length; while (i--) { newArray[i] = oldArray[i]; } return newArray; If you're storing objects in the array

RE: [Flashcoders] Copy Constructor

2006-11-03 Thread Mike Keesey
PROTECTED] On Behalf Of Paul Steven Sent: Friday, November 03, 2006 10:44 AM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Copy Constructor I think the problem may be that I am recursively creating the copies. Here are the two classes in full if anyone would be kind enough to see

RE: [Flashcoders] Copy Constructor

2006-11-03 Thread Paul Steven
Thanks a million Mike, I will give that a go Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Keesey Sent: 03 November 2006 19:32 To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Copy Constructor I don't see anything wrong after

RE: [Flashcoders] Copy Constructor

2006-11-02 Thread Paul Steven
Perhaps it is easier if I explain what I need: I am rewriting some Java code into AS2. Basically I have a class called Connect4State class Connect4State { public function Connect4State() { // - // Initialize the board array

RE: [Flashcoders] Copy Constructor

2006-11-02 Thread Mike Keesey
] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Paul Steven Sent: Thursday, November 02, 2006 2:31 PM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Copy Constructor Perhaps it is easier if I explain what I need: I am rewriting some Java code into AS2. Basically I have a class called

RE: [Flashcoders] Copy Constructor

2006-11-02 Thread Steven Sacks | BLITZ
How about this? class Test { var foo:String; var bar:String; function Test(initObj:Object) { for (var a:String in initObj) { this[a] = initObj[a]; } } public function get data():Object {

RE: [Flashcoders] Copy Constructor

2006-11-02 Thread Mike Keesey
To: Flashcoders mailing list Subject: RE: [Flashcoders] Copy Constructor How about this? class Test { var foo:String; var bar:String; function Test(initObj:Object) { for (var a:String in initObj) { this[a] = initObj

RE: [Flashcoders] Copy Constructor

2006-11-02 Thread Paul Steven
] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Paul Steven Sent: Thursday, November 02, 2006 2:31 PM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Copy Constructor Perhaps it is easier if I explain what I need: I am rewriting some Java code into AS2. Basically I have a class

RE: [Flashcoders] Copy Constructor

2006-11-02 Thread Mike Keesey
list' Subject: RE: [Flashcoders] Copy Constructor Thanks a million Mike, that works perfectly. I now have a chance of getting this game up and running by the morning. One question though. I commented out the super(); after reading the following: The super() call in the constructor class