I think I have uncovered a bug in AS3 client-side API.
Two users 1 and 2, three rooms A, B and C.
Both users enters room A
User 1 go to room B
User 2 go to Room C
Now Room A is empty
User 1 go to room A
The client receives the message from the server and it contains one user as expected:
[trace] [ RECEIVED ]: <msg t='sys'><body action='joinOK' r='1'><pid id='1'/><var
s /><uLs r='1'><u i='15' m='0' s='0' p='1'><n><![CDATA[guest_2968]]></n><vars><v
ar n='color' t='n'><![CDATA[16777008]]></var><var n='y' t='n'><![CDATA[-224]]></
var><var n='x' t='n'><![CDATA[66]]></var></vars></u></uLs></body></msg>, (len: 289)
The onJoinRoom event is received also as expected and I do the following:
users = evt.params.room.getUserList();
trace("Users in room " + room.getId());
for each (user in users) {
trace("user: " + user.getId());
}
Which gives me this output:
[trace] Users in room 1
[trace] user: 14
[trace] user: 15
Which is NOT at all what I expected - there should only be one user in the room. To me it looks like the client code forgets to update some internal state.
Regards
Kaare
Missing userlist update when joining a room - AS3 API
this sounds really odd. If what you say is correct then the Flex example chat wouldn't work. If you check it with 2 clients you will see that the user list behaves correctly.
Also the code we use in the example is really similar:
as you can see we essentially use the same for ... each iteration.
Can you provide the code that creates the bug?
Also the code we use in the example is really similar:
Code: Select all
public function onJoinRoom(evt:SFSEvent):void
{
var room:Room = evt.params.room as Room
var provider:ArrayCollection = new ArrayCollection()
// Set the selection in the room list component
setRoomListSelection(room)
// Cycle through all users in the list and add them to the provider
for each(var u:User in room.getUserList())
{
provider.addItem( {label:u.getName(), data:u.getId()} )
}
// Add a sort field to the room list component. Names will be sorted alphabetically
if (provider.sort == null)
{
var sort:Sort = new Sort()
sort.fields = [new SortField("label")]
provider.sort = sort
}
provider.refresh()
userList.dataProvider = provider
ta_chat.htmlText = "<font color='#cc0000'>{ Room <b>" + room.getName() + "</b> joined }</font><br>"
}Can you provide the code that creates the bug?
The patch is ready ( it also contains the 1.5.1 server side patch which is not needed in order to fix the reported issue )
All you have to do is unzip the archive and copy the new swc library file to a folder of your choice.
You can download the patch from here
All you have to do is unzip the archive and copy the new swc library file to a folder of your choice.
You can download the patch from here