This is an example snippet of code Im using upon joining a room to get variables:
Code: Select all
var players:Array = smartFox.lastJoinedRoom.playerList;
for each(var player:User in players){
playerVariable = player.getVariable("variableName").getValue();
}*If I was the CREATOR of that room and I rejoin that room (happens when another user is present and the room isn't destroyed) the other user's variables DISAPPEAR. Even though I can confirm via the admin tool they are still present.
*After the above instance, if the other user leaves and rejoins the same room, that user then experiences the problem.
Yup you heard me right, they go poof as a
Code: Select all
trace(player.containsVariable("variableName"));However, the wierd thing is.. is that variables that were created prior to joining that room.. such as in the main lobby.. such as "nickName" or "avatar" still exist. Just the variables that were made for game functions disappear .
If there is an immediate "gotcha" that you see let me know, if not and you need me to get deep and post some code, let me know.
***** UPDATE *****
I seem to have narrowed it down to this:
If I join a room, player.getVariable("myGameVariable").getValue() works for OTHER players in the room as it seems to be transparently displaying the variables.
However, it WON'T display MY player's variables .. as if they don't exist on myPlayer.getVariable("myGameVariable") . I even added a button to get the variables in question on click to test if its just a timing problem and its seems that it isn't. It persistently will not display my game variables whether i join a room or join a room a just created with my player, click the refresh button every time. No joy.
Note: Variables still show up correctly and accurately on the serverside via the admin tool. So something is either removing them (i checked and rechecked my client side code and found nothing that would do this) or they are just not being updated when I join a room.
However.. variables created such as "nickName" and "avatar" still show up persistently fine. (these are created upon choosing a character after logging in)
I am really at a loss here