0

I have a multi user application (chat) (Flash CS6 AS3) where the userlist has more than 300 users on peak hours, I have noticed the SWF becomes slower as the userlist updates and is removing and adding more than 300 users. so my question is, is there a way just to update the list component by removing the user that just disconnected or adding the one that connected without re-populating the whole list? Thank you!

This is the current code:

//The function gets called everytime a SYNC is sent from server (FMS)  
function syncEventHandler(event:SyncEvent)
        {
                list1.removeAll();
                for (var i in users_so.data)
                {
                    if (users_so.data[i] != null)
                    {
                        var clientObj = users_so.data[i];

                           list1.addItem({label:clientObj.UserName});
                     }


            }
    }
Alex
  • 25
  • 1
  • 8

1 Answers1

1

You could try storing your user list in an ArrayCollection (which has .addItAt() and .removeItemAt() methods that can be used in concert with .getItemIndex() to manage members of the underlying array)

ffxtian
  • 559
  • 2
  • 5