Skip navigation
Operandom
Currently Being Moderated

How to share remoteclass with netGroup?

Sep 25, 2012 8:56 AM

Hi!

 

I try to share instance of a class between two applications but the message receive is just an object and not the instance of the class and when I try to convert it into a class, I get a "null" value.

 

Here some infos about what I done:

 

a exemple class:

[Bindable]
[RemoteClass(alias="com.brand.Message")]
public class Message
{
     // Some properties
}

 

I send it with netGroup:

_netGroup.sendToNearest(message, neighbor.address);

 

So on the other application I receive the Message instance as an Object so I try to convert it to Message:

var message:Message = event.info.message as Message;

 

But message is "null" when it's done...

 

So, is it possible to receive automaticly the good object type (here "Message") and, if not, how to convert it?

 

Thx!!

 
Replies
  • kglad
    62,147 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 25, 2012 9:49 AM   in reply to Operandom

    only a serializable object can be sent.  you can serialize your object by using describeType().  you would then need to read the resulting xml and recreate the object using those data.

     
    |
    Mark as:
  • kglad
    62,147 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 25, 2012 12:11 PM   in reply to Operandom

    are you creating a bytearray of your object to serialize it?

     
    |
    Mark as:
  • kglad
    62,147 posts
    Jul 21, 2002
    Currently Being Moderated
    Sep 25, 2012 2:05 PM   in reply to Operandom

    nvm.  you're using p2p networking for all recipients have access to that class.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points