SFS2X - SetUserVariable not returned to sender

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

louissi
Posts: 48
Joined: 03 Mar 2006, 20:55

SFS2X - SetUserVariable not returned to sender

Postby louissi » 21 Sep 2011, 15:28

Hello!
I am trying to add the ping next to my player's name on the player list.
Naturally, I enabled the lag monitor after the login as such:

Code: Select all

sfs.enableLagMonitor(true);


Then, when I receive the event, I set a user variable called "ping".

Code: Select all

private function onPingPong(evt:SFSEvent):void
      {
         var lag:int = evt.params.lagValue;
         trace("PING PONG: "+lag);
         
         if(handlers_pingPong != null){
            handlers_pingPong(lag);
         }
      }


handlers_pingPong is a function in my lobby that I set before.

Here is the said function:

Code: Select all

private function pingPongHandler(lag:int):void{
         trace("received ping, update user variable");
         var userVars:Array = new Array();
         userVars.push(new SFSUserVariable("ping", lag));
         NetworkManager.getInstance().SetUserVariables(userVars);
      }



All of this works, and the user variable call is sent.
However, I do not get a response from the server (a userVariableUpdate event) or something like that. Is there a reason why the server doesn't send me an update? It says in the documentation that this call should send the event even to the sender. :(
appels
Posts: 464
Joined: 28 Jul 2010, 02:12
Contact:

Postby appels » 21 Sep 2011, 17:01

if i recall right the sender doesn't get the update, you can manualy poll for it and see if it's there.
louissi
Posts: 48
Joined: 03 Mar 2006, 20:55

Postby louissi » 21 Sep 2011, 17:14

appels
Posts: 464
Joined: 28 Jul 2010, 02:12
Contact:

Postby appels » 21 Sep 2011, 18:39

ah no, my bad, you do get the update on the sender.
I just tested it.
Can you see the variable in the admin tool for the user ?
Did you add the callback on the client ?
louissi
Posts: 48
Joined: 03 Mar 2006, 20:55

Postby louissi » 21 Sep 2011, 19:30

Yes the variable is there :?

http://screencast.com/t/poLkz6MZC

Ill make sure my callback is there, but it should be. Its really wierd. Ill try calling the variable something else, maybe "ping" is something smartfox is reserving.
louissi
Posts: 48
Joined: 03 Mar 2006, 20:55

Postby louissi » 21 Sep 2011, 20:36

Wooops. My bad. Listener wasn't there. I was pretty sure I added it.
appels
Posts: 464
Joined: 28 Jul 2010, 02:12
Contact:

Postby appels » 21 Sep 2011, 20:53

It happens :)
Good you solved it.

Return to “SFS2X ActionScript 3 API”

Who is online

Users browsing this forum: No registered users and 16 guests