[Variables] RoomList Update

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Posts: 23
Joined: 18 Dec 2008, 20:03

[Variables] RoomList Update

Postby x.Mara.x » 26 Apr 2009, 16:24

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)
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!
User avatar
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Postby BigFIsh » 27 Apr 2009, 18:54

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.
Smartfox's forum is my daily newspaper.

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: Majestic-12 [Bot] and 24 guests