All of these techniques copy generic objects (as in property containers,
name value pairs). Typed objects do not function in exactly the same way. As
a result, you can't clone them generically.

Troy.


On 5/26/07, Lucas Pereira <[EMAIL PROTECTED]> wrote:

  Hi.
Right now I'm having the same problem.
I even found this:

public function cloneObject(o:Object):Object
{
var bytes:ByteArray = new ByteArray();
bytes.writeObject(o);
bytes.position = 0;
return bytes.readObject();
}

but ended up always in the casting problem :(

Had you find an answer?

Thanks

Best regards

--- In [email protected] <flexcoders%40yahoogroups.com>, "
ben.clinkinbeard"
<[EMAIL PROTECTED]> wrote:
>
> Does anyone know how to do this? Neither casting nor the "as" operator
> are working.
>
> var foo:FooObject = new FooObject();
>
> // this doesn't work
> var fooCopy:FooObject = FooObject(ObjectUtil.copy(foo));
>
>
> // neither does this
> var fooCopy:FooObject = ObjectUtil.copy(foo) as FooObject;
>
> Thanks in advance for any pointers,
> Ben
>

Reply via email to