Skip to main content
Participating Frequently
January 22, 2007
Question

NetConnection.call

  • January 22, 2007
  • 2 replies
  • 284 views
My goal is as follows. Say I have a chat app called "mychatpp" and with in that app I have a bunch of different chat rooms such as "chatroomone" , "chatroomtwo" and so on. So I've created a combo box and filled it with all of the chat room names. I want to also add a user count in the combo box beside each chat room name. The problem is I can't figure out how to access the user count for a chat app or for each individual room within a chat app.

I have been trying something like this but haven't had any luck yet.

nc = new NetConnection;
nc.connect("rtmp://www.myflashmediaser.com/mychatapp/");
nc.call("userCount", true);

I can't figure out how to access the returned value. Also notice that my connect string just points at the app and doesn't reference an individual room, in order for it to be useful I need to get the user count for an individual room.

Any help would be appreciated.
    This topic has been closed for replies.

    2 replies

    dadonkAuthor
    Participating Frequently
    January 22, 2007
    Thank you, that makes much more sense then what I was attempting. Say I have an array of chat rooms that exist in the chat app and I want to loop through them to get a user count for each room and then add that chat room name and user count to an option in a combo box, can I do it with a single netconnection something like this?

    nc = new NetConnection;
    nc.connect("rtmp://www.myflashmediaser.com/mychatapp/");

    for (i=0; i<chatroomsArray.length; i++) {
    chatRoomUserCounts = SharedObject.get("chatRoomUsers");
    var thisChatRoomUserCount = myInfo.getProperty("chatRoomOneUserCount");
    chatRoomListCB.addItem({data:chatroomsArray , label:chatroomsArray+" ("+thisChatRoomUserCount+")" });
    }
    Inspiring
    January 22, 2007
    I recommend creating a server side shared object that contains the user count. That way you don't have to deal with any complicated calls to different clients.