I don't know how to do this way in Flex:

function nc.onUserInfo = function(userInfo) { 
    trace (userInfo); 
    trace (userInfo.name); 
    trace (userInfo.age);
    trace (userInfo.gender);
}

Anybody know??? 



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Daniil Tutubalin
Sent: Friday, April 27, 2007 9:45 AM
To: [email protected]
Subject: [Red5] How to send custom object from Red5 to Flash?

Hello.

We faced a problem with sending custom objects from Red5 to Flash.

For example, we have something like this:

public class UserInfo { 
    public String name; 
    public int age; 
    public boolean gender; 

    public UserInfo (String name, int age, boolean gender) { 
          this.name = name; 
          this.age = age; 
          this.gender = gender; 
    } 

}


Then we try to send object of this class:

userInfo = new UserInfo("Dan", 27, true); 
connection.invoke("onUserInfo", userInfo);

But Flash receives it in very odd way: it has all fields but
it is undefined!

So, if we have such code on Flash:

function nc.onUserInfo = function(userInfo) { 
    trace (userInfo); 
    trace (userInfo.name); 
    trace (userInfo.age);
    trace (userInfo.gender);
}

We will get:
undefined
Dan
27
true


So all conditions like if (x!=undefined) will work in the wrong way.

What is the right way to send custom objects, so they would be traced
like
[object], not undefined?

Thank you in advance.


_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to