I want to have a room list, as well as a list of rooms that your buddies are in. So I'll end up with two lists, one listing all the rooms (room name and the current/max users), and another that lists only the rooms buddies are in (room name, which buddy, and current/max users).
Is this possible?
What I have so far is this:
Code: Select all
smartfox.onBuddyList = function(bList:Array)
{
trace("loaded buddy list from server");
for (var i in bList)
{
trace(bList[i].name + (bList[i].isOnline ? "Online" : "Offline"));
trace("in room:");
smartfox.getBuddyRoom(bList[i]);
}
}
smartfox.onBuddyListError = function(errorMsg:String)
{
trace("Buddy list error: " + errorMsg);
}
smartfox.onBuddyListUpdate = function(buddy:Object)
{
trace("Buddy List update for: " + buddy.name);
trace("in room:");
smartfox.getBuddyRoom(buddy);
}
smarfox.onBuddyRoom = function(idList:Array)
{
var roomObj:Room = smartfox.getRoom(idList[0]);
trace("Room name: " + roomObj.getName());
}
The buddy list appears to load correctly, and correctly reports online/offline, but the onBuddyRoom handler never seems to get called, and I'm not sure why.
Also, I'm aware of a potential problem with this approach: onBuddyRoom doesn't seem to know which buddy the room is for. I can probably find a way to work around this, but I need to actually get the room my buddy is in first...