I've been trying to clone one of my custom objects for a few days now and tried all examples i could find. I also added "[RemoteClass]" before every class.
I used a custom (which is probably the same) and the mx.utils.objectutils.copy function:
public static function clone(value:Object):Object
var buffer:ByteArray = new ByteArray();
buffer.position = 0;
var result:Object = buffer.readObject();
Both gave me the same error message:
"ArgumentError: Error #1063: Argument count mismatch on basecreatures.water::Naga(). Expected 1, got 0.
at flash.utils::ByteArray/readObject() [....]"
The class Naga is being extended by the class Creature, which both require some arguments. I used it like this:
target is an object of the class Naga which is working perfectly. Using some other clone methods, the cloned object didn't get the functions of the Creature class.
I don't believe you can clone objects that lack a zero-argument constructor. Can you make the argument optional?
Truviso is hiring: http://www.truviso.com/company-careers.php?i=87
EDIT: I didn't read you first reply well. ObjectUtil should be able to copy your object without a problem. If it's giving you an error then you're doing something else wrong. If you could post a sample class that you are trying to copy and is not working, then we might be able to provide more information.