Copying objects

Hello Guys

[size=2][size=2]I want to know how to copy an object of the same class. Example[/size]


[size=2]var x:new Obj();
var y:new Obj();[/size]



[size=2]The Obj class has an array in it. All other primitives are copied nicely but there are some problems with the array. [/size]

[size=2]I think the pointer is pointing towards the old location even after copying.[/size]

[size=2]Please suggest the best possible way of doing this.[/size]