I'm using Cirrus to pass some values to other players in my game, and some of those values are objects, thing is, that when I receive those objects, they lost their type, and they become generic objects.
I've read that Cirrus uses AMF, but I don't know how to regain the original object type of my data.
Edit.:
//these are the classes involved
registerClassAlias("Action", Action);
registerClassAlias("EntityVO", EntityVO);
registerClassAlias("Point", Point);
//Action takes 3 parameters
Action(type:String = "", entity:EntityVO = null, target:EntityVO = null)
// when EntityVO doesnt require a parameter in the constructor or it has a string/int parameter this works:
var entity = new EntityVO();
var byteArray:ByteArray;
byteArray = new ByteArray();
byteArray.writeObject(action);
byteArray.position = 0;
var object:Object = byteArray.readObject(); //<- works ok
//when I make EntityVO to take a non standard parameter like, a Point, like this:
EntityVO(point:Point = null)
//and I do this:
var entity:EntityVO = new EntityVO(new Point());
var action:Action = new Action("addEntity", entity);
var byteArray:ByteArray;
byteArray = new ByteArray();
byteArray.writeObject(action);
byteArray.position = 0;
var object:Object = byteArray.readObject(); //<- it goes into the EntityVO constructor and says that point is null, (I use point in the constructor to set something)