RosterEvent.ROSTER_LOADED

when user login in, i listened RosterEvent.ROSTER_LOADED event to get his buddy list include buddy status, such as “on phone”, “away” .

but when i get each RosterItemVO form roster group, i found status property of RosterItemVO is stale and online property are all false.why?

code as blow:

modelLocator.model.rosterManager.roster.addEventListener(RosterEvent.ROSTER_LOAD ED, function():void {
var groups:ArrayCollection = modelLocator.model.rosterManager.roster.groups;
_buddyGroup = groups;
callLater(renderFriendTree);
});

I suspect that you’re seeing the initial values, and are getting to it before the data has been updated. When the roster is initially loaded, it doesn’t come with everyone’s actual status, that comes in a presence packet later on. I encountered a similar problem myself. In my case, I was setting my presence before the roster was loaded, and it was causing openfire to send everyone else’s presence before the roster reply, so it had nothing to fill out. I fixed it by:

  1. Not sending my presence out until after the roster was loaded.

  2. Attaching my code to a CollectionEvent.COLLECTION_CHANGE event, ie:

modelLocator.model.rosterManager.roster.addEventListener(CollectionEvent.COLLECT ION_CHANGE, setupGroups);

private function setupGroups( event : CollectionEvent ) : void

{

var groups : ArrayCollection = modelLocator.model.rosterManager.roster.groups;
_buddyGroup = groups;
callLater(renderFriendTree);
}

–Pete