Page 1 of 1

[Variables] RoomList Update

Posted: 26 Apr 2009, 16:24
by x.Mara.x
Well, im trying to do a code so that you can see only the rooms that YOU created, in a lb called myroomList.. well, i have a variable called duenoactu in the room variables, but when, to try to see if it works, i put as a room lable "Room name, user count, owner:" it always comes as undefined, and in the room itself i have owner: and it shows the value.. whats the problem?

smartfox.onRoomListUpdate = function(roomList:Object, room:Room)
{
_root.navegador.roomList_lb.removeAll()
_root.navegador.myroomList_lb.removeAll()
for (var i in roomList)
{
room = roomList[i];
rv = room.getVariables();

_root.navegador.roomList_lb.addItem(room.getName() + " (" + room.getUserCount() + ") "+rv.duenoactu, room.getId())
if (rv.duenoactu == "test") {
_root.navegador.myroomList_lb.addItem(room.getName() + " (" + room.getUserCount() + ")", room.getId())

}

}
_root.navegador.roomList_lb.sortItemsBy("label", "ASC")
_root.navegador.myroomList_lb.sortItemsBy("label", "ASC")
//Quite el this.autoJoin()


}


help please!

Posted: 27 Apr 2009, 18:54
by BigFIsh
You won't get the room variables unless you join it. That is how it's designed - to save bandwidth.

A workaround could be to create custom [url=
http://www.smartfoxserver.com/docs/docP ... essage.htm]generic message[/url]. Simply check if the "host" of the room is the user who's requesting for room list - if true, add room to list and so on (then send it). This method saves bandwidth, but it's tricky to implement.

An easier alternative is to have an array on client/user's side that stores all room names that he created - and do a simple check to see if they match with the names of the room you received from the server.