Multi room, sender object comes back null in onPublicMessage
Posted: 21 Jun 2010, 18:54
Hello,
My game allows users to join two rooms at once. The first is a Lobby, which everyone can join. The second is an optional group chat, with a subset of users.
When a user joins a group chat, they suddenly do not receive a sender object from lobby chat messages.
The code is executed in this order...
This occurs in onRoomListUpdate:
And that works just fine.
When we successfully join the room (onJoinRoom), we get the Lobby's Id and set some user variables
And then update the room list
This time, when the room list is updated, we do the following:
Note that _groupRoomName is defined elsewhere in the game. It is correct in all of my test cases.
joinGroupRoom looks something like this:
After this last joinRoom, we start losing the sender objects in the lobby. The group chat however, is receiving them just fine. A public chat message event looks like this:
Any thoughts? I have inherited this code, so I'm not sure if this approach is even possible, let alone proper. Any feedback would be very much appreciated.
Thanks!
My game allows users to join two rooms at once. The first is a Lobby, which everyone can join. The second is an optional group chat, with a subset of users.
When a user joins a group chat, they suddenly do not receive a sender object from lobby chat messages.
The code is executed in this order...
This occurs in onRoomListUpdate:
Code: Select all
for each (var room:Room in roomList) {
if (room.getName() == myLobby) {
_smartFoxClient.joinRoom(room.getId());
return;
}
}
When we successfully join the room (onJoinRoom), we get the Lobby's Id and set some user variables
Code: Select all
var room : Room = event.params.room;
_lobbyRoomId = room.getId();
_smartFoxClient.setUserVariables(uVars);
Code: Select all
_smartFoxClient.getRoomList();Code: Select all
var roomArr : Array =_smartFoxClient.getAllRooms();
for each (var room : Room in roomArr) {
if (room.getName() == _groupRoomName) {
_groupRoomId = room.getId();
joinGroupRoom();
break;
}
}
joinGroupRoom looks something like this:
Code: Select all
public function joinGroupRoom() : void {
if (connectionNotOk()) {
return;
}
_smartFoxClient.addEventListener(SFSEvent.onJoinRoom, onGroupRoomJoin);
_smartFoxClient.joinRoom(_groupRoomId, "", false, true);
}
Code: Select all
params Object (@1433d061)
message "Some lobby chat message here"
roomId 8 // The Lobby Room Id is correct
sender null
Thanks!