views:

52

answers:

2

Hi All,

I have a windows service behaving as a Binary Socket sending data to flex applications. Once I try to send strings or int's or any other native data-type, everything is working great.

I even succeeded in sending JSon from the server to the client parsing it on Flex.

I want to send AMF objects to the client.

Meaning, I have a class called User, I want to fill it with data and send it to the client, there I want it to be mapped to an object on the client.

How can I achieve this?

A: 

Haven't you already accomplished this with JSON? Just serialize your object as JSON and deserialize it on the client.

Hasan Khan
I have accomplished it with Json, although I think it can be more efficient to send the class to the client through AMF and not serialize it to Json both on server side and on client side.
Avi Tzurel
A: 

I'm not sure if any of these links is what you want:

http://www.adobe.com/devnet/flex/articles/class_mappings.html

http://www.adobe.com/livedocs/flex/2/langref/flash/net/package.html#registerClassAlias%28%29

http://livedocs.adobe.com/flex/3/langref/flash/utils/IExternalizable.html

but it should get you started, and google can take you from there. I remember there was this adobe page with a ton of examples of sending various data types to C#, but I can't seem to find it right now.

jonathanasdf
I have tried it both with class mapping and IExternalizable, none of these worked, when I sent the class to the client and read it through readObject(); I received null, even though I made all of the adjustments.Thanks anyway, if you come across the article you mentioned I'd love to read it.B.T.WGoogling gave me no answers on sending those classed on top of a socket connection
Avi Tzurel