i have a practicelobby static room(group id:practice) and a premiumlobby static room(groupid : premium) both in one zone.
when the user clicks on the premium lobby button i need to switch him from practicelobby to premium lobby room.
in the function which is switching i first make a check like
Code: Select all
public function toggleLobbyRoomTo(newroomName:String):void
{
if( sfs.mySelf.isJoinedInRoom(sfs.getRoomByName(newroomName)))
return;the line at SFSUser.isjoinedInRoom() function throws an exception "cannot access method or property of null object reference".
i figured out that if i set the group id on both these rooms to be "default". then this exception doesnt occur!
then i set it to "lobby" on both as their groupid. and it occurs again!
from what i figure out isjoinedinroom() function only works when the room you are passing to it is their in your local roomlist.
is this the case and expected behaviour?
should i be handling this exception as an indication that the room is not present in the local room list and hence ofcourse the user is not joined in it. but is this the right way?
or should i first make a check that the room exists in localroomlist and after that only check if the user is joined into that room using isjoinedinroom function?
any ideas?
thanks.