-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
] [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
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
/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
.
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
] 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
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
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
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
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
] [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
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 {
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
] [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
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
15 matches
Mail list logo