powered by Jive Software

How to know when a roster has loaded?

I’'m writing a flash game application that uses Jive for individual IM chatting within the game. When a contestant loads the game, I have them log-in to Jive, which then triggers the fetchRoster() method upon the ‘‘login’’ event.

I’‘m trying to populate a ComboBox with the available roster members - the CB is used by the contestant to select the buddy that they want to send a message to during the game. I’‘m using the “login” event to trigger the population of the CB, as follows (’‘buddies’’ is the CB:

case “login”

for (var i=0; i< roster.length; i++) {

trace("BUDDY "+roster.getItemAt(i).displayName + " " + roster.getItemAt(i).status);

if (roster.getItemAt(i).status == “available”) {

buddies.addItem(roster.getItemAt(i).displayName.toString());

}

}

buddies.setStyle(“fontSize”, 8);

break;

The problem is that when the code above is run, the roster’'s dataHandler has not yet been populated (as evidenced by tracing the ‘‘incomingData’’ and ‘‘outgoingData’’ events).

Is there a way to trigger the population of the ComboBox when the roster has loaded, rather than on the “login” event?

Thanks in advance …

So, it appears that I can handle this by populating the ComboBox upon either a ‘‘presence’’ event, or an ‘‘userAvailable’’ / ‘‘userUnavailable’’ event, since the buddies on the roster will broadcast their presence upon registering with the jive server. I ended up using the roster events of ‘‘userAvailable’’ and ‘‘userUnavailable’’ to trigger the ComboBox updates.