나는 내 게임에서 다른 플레이어에게 일부 값을 전달하기 위해 Cirrus를 사용하고 있으며 그 값 중 일부는 객체입니다. 그 객체를 받으면 유형이 손실되어 일반 개체.Cirrus를 사용하여 수신 한 객체를 직렬화하지 않음
Cirrus는 AMF를 사용하고 있지만 데이터의 원래 개체 유형을 다시 얻는 방법을 모르겠습니다.
편집 : 당신은 두 가지를 할 필요가
//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)
두 swfs가 동일한 클래스의 동일한 버전을 가지고 있다면이 매개 변수는 자동으로 deserialize되어야한다고 생각합니다. 객체가 상호 작용하는 클라이언트의 다른 버전 인 경우에만 생각할 수 있습니다. AMF가 BlazeDS와 함께 사용되는 경우 RemoteAlias 메타 데이터 태그가 사용되거나 별칭을 등록합니다.하지만 항상 AS3 클래스에 매핑되는 Java 클래스 이름 또는 PHP 클래스 이름이라고 생각합니다.이 유형은 모두 AS3/AMF이므로 상상할 수 있습니다. 유지. 두 클라이언트 모두 정확한 swf를 보유하고 있습니까? – shaunhusain
그래, 그들은 같은 swfs입니다. – Artemix
Action 클래스는 생성자에서 EntityVO 사용자 정의 객체를 요구합니다. 왜이 객체가 작동하지 않습니까? – Artemix