In AVChatManager.as:
onRed5ConnectionStatus
There is a for each loop here that iterates on chatSessions and calls stopChat(). stopChat() uses delete on a key in the chatSessions array. I have seen undefined and erratic behavior from Flash when this happens, including skipping all the rest of the elements in chatSessions.
This may not be causing any big problems, but it looks like a potential bug.
onRed5ConnectionStatus chat sessions remove for each bug
It seems that the erratic behavior does not show up in test cases where keys in the array are continuous and consecutive. For example, uncomment the _array[3] line and this test will work, but leave it commented out and a value will be skipped:
Code: Select all
var _array:Array = new Array();
_array[0] = {"id":0};
_array[1] = {"id":1};
_array[2] = {"id":2};
//_array[3] = {"id":3};
_array[4] = {"id":4};
for each( var val in _array )
{
trace("val.id:"+val.id);
delete _array[val.id];
}
for each( var remaining in _array )
{
trace("remaining.id:"+remaining.id);
}
/*
output (Flash CS4 v10.0):
val.id:0
val.id:1
val.id:2
remaining.id:4
*/
What you say is valid for indexed arrays, but chatSessions is an associative array, where the key is a string (the session id). Change your test like this:
No item is remaining inside the array.
Code: Select all
var _array:Array = new Array();
_array["id0"] = {"id":0};
_array["id1"] = {"id":1};
_array["id2"] = {"id":2};
//_array["id3"] = {"id":3};
_array["id4"] = {"id":4};
for each(var obj:Object in _array)
{
trace("obj.id:"+obj.id);
delete _array["id"+obj.id];
}
for each(var remaining:Object in _array)
{
trace("remaining.id:"+remaining.id);
}Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Code: Select all
_array["k0"] = {"id":"k0"};