ObjectUtil.copy is not working as you are expected

Couple of minutes back when I tried to deep copy my object its just returning me null.
when I tried to assign it for a object its working.
I gone through the implementation its simple and effective…

public static function copy(value:Object):Object
{
var buffer:ByteArray = new ByteArray();
buffer.writeObject(value);
buffer.position = 0;
var result:Object = buffer.readObject();
return result;
}

Then why its not working… reason is simple :)
Copies the specified Object and returns a reference to the copy. The copy is made using a native serialization technique. Confused.

Use the [RemoteClass] metadata tag to register the class with Flex so that Flex preserves type information when a class instance is serialized by using Action Message Format (AMF).
We have two ways to add the type information to the class:
1 . using [RemoteClass]
2. registerClassAlias(“my.pkg.class”,class);

This will resolve the problem.

Share and Enjoy:
  • del.icio.us
  • Facebook
  • co.mments
  • DZone
  • IndianPad
  • MySpace
  • StumbleUpon
  • Technorati
  • Twitter

Tags: , ,

Leave a comment