How to refresh the room list?

Everything about the SmartFoxBits UI Components for SmartFoxServer 2X. Post your questions, suggestions and bug reports.

Moderators: Bax, Lapo

How to refresh the room list?

Postby jonc » 01 Apr 2011, 06:24

Hi,

I have a room list in our lobby up and running. The rooms are created server side. We create a unique room name for each and I set a global variable on them with the name of the scenario that is used for each.

I want to display this scenario instead of the room name in the lobby room list. So I've created a setCustomRoomLabel() function that I call to write out the scenario name instead of the room name.

This all works fine, except that if a user is in the lobby when a new room is created, the room name gets added to the list when it is created and then not updated when the variable is set. I need to listen for the variable being set with the scenario name and then update the room list. But I can't see any way of refreshing the list (the user list has such a function).

Is there a way to do this? Or should I be approaching the problem differently?

This is the server side code that creates the room and sets the variable:

Code: Select all

room = SmartFoxServer.getInstance().getAPIManager().getGameApi().createGame(zone, settings, user);

SFSRoomVariable scenarioVar = new SFSRoomVariable("scenario", scenarioName);
scenarioVar.setGlobal(true);   // make scenario name visible to all so lobby can see it
room.setVariable(scenarioVar);



Thanks!
jonc
 
Posts: 18
Joined: 08 Oct 2010, 02:57

Postby Bax » 01 Apr 2011, 07:59

Use the RoomList.list property to access the inner List component.
Then you can refresh it (in Flash) or its dataprovider (in Flex).
Paolo Bax
The SmartFoxServer Team
User avatar
Bax
Site Admin
 
Posts: 3845
Joined: 29 Mar 2005, 09:50
Location: Italy


Return to SmartFoxBits for SFS 2X

Who is online

Users browsing this forum: No registered users and 1 guest