Nafiz
Nafiz

Reputation: 462

AMF3 decoder in Flex?

How can i decode AMF3 Object in Flex. We have a python Socket server which encodes data as AMF3.

We already deserialize data in Android Client but cant find a good way to do that in Flex.

Edit.

Take a look how we are doing Java for Android client.

String res = res.substring(1);
InputStream in = new ByteArrayInputStream(res.getBytes()); 
DataInputStream dis = new DataInputStream(in);
AMF3Deserializer amf = new AMF3Deserializer(dis);
Object o = null;

try { 
    o = amf.readObject(); 
} catch (IOException e) {
    e.printStackTrace(); 
} 

Map map = (HashMap)o;

Object[] ob = (Object[]) map.get("result_set"); 
Object[] obn = (Object[]) ob[0];

Upvotes: 1

Views: 640

Answers (4)

knh
knh

Reputation: 21

incase there are new searchers for this topic, in AS3, use flash.net.Socket.readObject() method. It will automaticaly read the object as AMF format

Upvotes: 2

Sophistifunk
Sophistifunk

Reputation: 5042

ByteArray.readObject() will decode AMF.

Upvotes: 2

JeffryHouser
JeffryHouser

Reputation: 39408

Why wouldn't you use a RemoteObject to make your calls to the server? Then deserialization is handled automatically for you.

Did you write your own AMF serialization / deserialization methods on the server? Or did you use something like PythonAMF?

Upvotes: 0

ocodo
ocodo

Reputation: 30319

You can use RemoteObject to connect to a AMF service.

Read here for more info.

Upvotes: 0

Related Questions