create a room variable called isInPlay and set it to false
Code: Select all
function createRoom(name:String, pwd:String, max:Number) {
hideWindow("newGameWindow");
var gameRoom:Object = new Object();
gameRoom.name = name;
gameRoom.password = pwd;
gameRoom.maxUsers = 8;
gameRoom.isGame = true;
gameRoom.isTemp = true;
//
//create a room variable here that shows the game is not being played
//
smartfox.createRoom(gameRoom);
}how do i write an if statement to access the isInPlay room variable?
Code: Select all
smartfox.onRoomListUpdate = function(roomList:Object) {
roomList_lb.removeAll();
for (var i in roomList) {
var room:Room = roomList[i];
if (room.isGame()) {
roomList_lb.addItem(room.getName()+" ("+room.getUserCount()+")", room.getId());
}
}
roomList_lb.sortItemsBy("label", "ASC");
// Join the default room
this.joinRoom("The Entrance", "");
};Code: Select all
function changeRoom() {
if (!_global.isBusy) {
var item:Object = roomList_lb.getSelectedItem();
// new Room id
var newRoom:Number = item.data;
//
//
if (newRoom != smartfox.activeRoomId) {
// Check if new room is password protected
var priv:Boolean = smartfox.getRoom(newRoom).isPrivate();
if (priv) {
// Save newroom as _global for later use
_global.newRoom = newRoom;
showWindow("passwordWindow");
} else {
// Pass the room id
smartfox.joinRoom(item.data);
}
}
}
}