I have an object that I have created with "foo = new Object()". I would like to create a duplicate of this object, but it seems every way I try, the duplicate is actually just a reference to the same original object.
For example:
For example:
Code:
foo = new Object();
foo.member = 3;
bar = foo;
bar.member = 5;
trace(bar.member); // It outputs 5, of course
trace(foo.member); // It outputs 5 also ?!?!?
Of course that's a trivial case. But I need to duplicate the object so that the new object is completely separate from the original. Is it even possible?
All help is appreciated.