Thanks Steve
My arrays are multidimensional arrays
i.e
public var map:Array; // 3 dimensional array of booleans that holds lookup
table of winning combinations
public var board:Array; // A 7 by 6 two dimensional array of
integers representing the state of game
So from what I have read I would have thought concat() would do the job.
The problem may be that the original object recursively creates copies
within copies - bit out of my depth on this one!!
Paul
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks
| BLITZ
Sent: 03 November 2006 19:25
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Copy Constructor
> 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 not just numbers or strings, then
you need to clone those as well or they will just stored as pointers to
the objects in the other array.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com