Hi all!
I want to ask exactly how to remove the roomvariables?
When new player joining the room, the server create roomvariable named "player1", "player2", etc.
[code]
List<RoomVariable> roomVars = new ArrayList<RoomVariable>();
if (room.getVariable("player1") == null) {
roomVars.add(new SFSRoomVariable("player1", sender.getName(), false, false, true));
}
[/code]
When one of the player exiting the room, I remove the roomvariable with this code:
[code]
Room room = (Room) event.getParameter(SFSEventParam.ROOM);
if (room.getVariable("player1") != null && room.getVariable("player1").getStringValue().equals(sender.getName())) {
room.removeVariable("player1");
}
[/code]
When I check the localhost sfsadmin, it is true that the variable is removed, but when I test the flash movie, the roomvariable is still there!
Any thoughts? Thanks.
How to remove the room variable?
Hi.
The removeVariable() method of a room is for internal use, i mean, to be used only by the server. That's why it isn't documented. In order to remove the variable, you have to set that variable to null, using the sfsApi.setRoomVariables() method.
The removeVariable() method of a room is for internal use, i mean, to be used only by the server. That's why it isn't documented. In order to remove the variable, you have to set that variable to null, using the sfsApi.setRoomVariables() method.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.