Page 1 of 1

user count from getRoomListFromGroup

Posted: 04 Jan 2016, 13:48
by aliko
Hello,

I get the user count from a grupid with below code.
Is there a way to get this count without a loop?

Code: Select all

cnt=0;
var roomList:Array = sfs.roomManager.getRoomListFromGroup(games_grup);
for each(var room:Room in roomList) {
    cnt=cnt+room.userCount;
}
trace("Total user count : "+cnt);

Re: user count from getRoomListFromGroup

Posted: 04 Jan 2016, 15:07
by Lapo
Hi,
what you're doing is correct, in other words aggregating the count of all Rooms in the Group.

There isn't a method in the API to count users in a Group so you could turn this code into a method and invoke it from any place in your code where you need it.

Cheers