Forum ActionScript 3.0 counting players on line ?

Problems and discussions relating to ActionScript 3.0 here.

counting players on line ?

Postby Bessis » November 9th, 2012, 3:15 pm

I amy made my hello world based on FridgeMagnet
here : http://www.yopsolo.fr/wp/2012/07/09/chicken-io/

I am using stuff like this
Code: Select all
Private function countPlayers():void
      {
         var nb:int = 1;
         for each( var c:Arrow in cursors)
         {
            if(c.stage){
               nb++;
            }
         }                     
         count_txt.text = nb.toString();         
      }


but i am sure there is a better way to do it, no ?
Bessis
 
Posts: 6
Joined: November 6th, 2012, 11:10 pm

Re: counting players on line ?

Postby Henrik » November 9th, 2012, 5:05 pm

http://playerio.com/documentation/refer ... layerCount

There's a property that contains the number of players connected to a room, just read that one instead... :-D
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: counting players on line ?

Postby Bessis » November 9th, 2012, 6:17 pm

wooo nice doc !
thx a lot :D
Bessis
 
Posts: 6
Joined: November 6th, 2012, 11:10 pm


Return to ActionScript 3.0



cron