Closed sk3tch closed 12 years ago
RemoteClass
only works when you use RemoteObject
to make calls to your AMF gateway. If you use the old style NetConnection#call
API, then the only way to ensure that the class is aliased is to use registerClassAlias
. Once you have properly aliased your object, you need to define a mapping in ruby so that your object is deserialized as the proper ruby class.
class Animal
attr_accessor :name, :age
end
# Map "Animal" in ruby to "Animal" in flash
RocketAMF::ClassMapper.define do |m|
m.map :as => 'Animal', :ruby => 'Animal'
end
Once you define a mapping in Ruby, then anytime you serialize or deserialize the mapped object, it will have the right class.
It looks like when the message contains a remote class, like this:
http://cookbooks.adobe.com/post_How_to_keep_the_type_of_your_objects_when_serializ-8323.html
Then the RemoteClass is skipped during the parsing.
Also, how would you create an object like a RemoteClass in Ruby to serialize?
Thanks!