Roster.length is always 1

I modified the XIFF-example a little bit too check Roster.length. This is always 1, also if I let another client join the chat. Can anybody help me? Here is the modified code:

I only modified this part:

// Room - CHANGE THESE SETTINGS

var chatRoom = new Room( connection );

chatRoster.dataProvider = chatRoom;

chatRoom.roomName = “flashroom”;

chatRoom.nickname = “flashclient”;

chatRoom.conferenceServer = “conference.192.168.1.23”;

var myRoster :Roster = new Roster(connection); // this has been modified

// Event handler

var eventHandler = new Object();

eventHandler.handleEvent = function( eventObj )

{

switch( eventObj.type )

{

case “outgoingData”:

trace( "SENT: " + eventObj.data );

break;

case “incomingData”:

trace( "RECEIVED: " + eventObj.data );

break;

case “login”:

// Connect to the conference server

myRoster.setPresence(null, “Online”, 5); // this has been modified

And this:

function addToChatOutput( nickname, text )

{

trace (“roster length=”+_root.myRoster.length); // this has been modified

if( nickname == chatRoom.nickname )

Message was edited by: dirkjan

myRoster seems to be your IM roster so it doesnt matter how many people enter the chatroom since it will only count the contacts you have added to your roster.

you need to look at the chatRoster one instead.

Thak you. Do you mean the roster of the chatroom?

chatRoster.dataProvider = chatRoom;

you used the chatRoom as a data provider for the chatRoster. so it means you are supposed to have a chatRoster instance on stage.