Skip to main content
September 25, 2009
Question

user count

  • September 25, 2009
  • 1 reply
  • 923 views

Hi Everyone,

I am working on flash chat in AS3,

i need to count the users in each room.

Is there any way to find..

Thanks in advance.

Saransoft

    This topic has been closed for replies.

    1 reply

    September 25, 2009

    If each room is a separate application instance, you can inspect the length of application.clients array. If several rooms reside within the same application instance, you'd need to use a different method, but that method would be determined by your application architecture.

    Are you already keeping a list of users for each room (perhaps in an array or a shared object)?

    September 25, 2009

    Hi,

    Thanks for your response.

    Yes i stored in the SharedObject,

    for ex: i created the room named "games", In that room i allowed only 40 users. If 41th user select the same room then i redirect to new room as named "games_1". Each time room is checked "games" and then redirect.

    My question is if the room "games" and "games_1" is occupied by 40 users each then 81th user select the "games" room. how i redirect to "games_2" instead of "games_1".

    Here is my piece of code.

    if(my_so.data.userName > 40){

    debug1.text = "yes";

    client_nc.connect("rtmp://v18022.uvault.com/webupgrade_chat/"+chat_room+"_"+1, username , sex);

    }else{

    debug1.text = "no";

    client_nc.connect("rtmp://v18022.uvault.com/webupgrade_chat/"+chat_room, username , sex);

    }

    client_nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);

    client_nc.call("getuserCount",null);

    function useCount(Count:Number):void{

    //refer.text = String(Count);

    my_so.data.userName = Count;

    refer.text = String(my_so.data.userName);

    userCount = Count;

    }

    User count for the room "games" is assigned in local shared object "my_so.data.userName"

    how i proceed..

    Saransoft

    September 29, 2009

    Hi,

    Is it possible to get the user count by passing the room name from flash to .asc file.

    I am in critical situation. Kindly help me...

    Saransoft