2 Replies Latest reply on Oct 19, 2010 4:24 AM by Pavlinius

    Typed objects p2p through netstream.send()

    Sean S Murphy Level 1

      Can type information be preserved when sending objects using the netstream .send method? I notice when debuggin on the other side that all the objects come through as just that, instances of the object class.

       

      Could you have a custom object instance, say Person, and send that via rtmfp to the other side and preserve the fact that it is a Person?

       

      Sean

        • 1. Re: Typed objects p2p through netstream.send()
          Marvin Blase Level 1

          As far as I know not. But to be honest your intention is not really clear to me - what's the point in passing a "custom" object?

          • 2. Re: Typed objects p2p through netstream.send()
            Pavlinius

            Hello. Yes you can preserve the type of the objects when they are sent with NetStream.send(). Just add [RemoteClass] metadata to the class which type you want to preserve.

             


                [RemoteClass]
                public class NetStreamMessage
                {

                      public var id:Number;

                      public var data:Object;

             

                      public function NetStreamMessage(data:Object)

                      {  

                           this.data = data;

                      }
                }

             

                var message:NetStreamMessage = new NetStreamMessage("some message");

                publishNetStream.send("handleMessageReceived",message);