Expand my Community achievements bar.

Exception In UserManager

Avatar

Level 2
Hi,

I used custom 'filterfunction' with
"userManager.userCollection" to filter some of the users out of the
collection and registered customField in 'userDescriptor' and when
that field is updated so the collection is updated too in order to
reflect new changes in the collection then after that here is what
i get.



RangeError: Index '0' specified is out of bounds.

at mx.collections::ListCollectionView/removeItemAt()

at
com.adobe.rtc.sharedManagers::UserManager/removeUserFromCollection()[com\adobe\rtc\sharedManagers\UserManager.as:1017]

at
com.adobe.rtc.sharedManagers::UserManager/onItemReceive()[com\adobe\rtc\sharedManagers\UserManager.as:853]

at flash.events::EventDispatcher/dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()

at com.adobe.rtc.sharedModel::CollectionNode/
http://www.adobe.com/2006/connect/cocomo/messaging/internal::receiveItem()[com\adobe\rtc\sharedModel...

at com.adobe.rtc.messaging.manager::MessageManager/
http://www.adobe.com/2006/connect/cocomo/messaging/internal::receiveItem()[com\adobe\rtc\messaging\m...

at
com.adobe.rtc.session.managers::SessionManagerBase/receiveItem()[com\adobe\rtc\session\managers\SessionManagerBase.as:330]



10 Replies

Avatar

Level 2
And This is the filter function i used :



private function dontaddMeInView(e:Object):Boolean{

if(e.userID==sess.userManager.myUserID){

return false;

}else{

return true;

}

}



Avatar

Former Community Member
Hi,



Have you also added the similar filter function to
hostCollection, participantCollection and audienceCollection. My
take is, since inside the functions removeUserFromCollection and
addUserToCollection in UserManager, we are adding/removing from in
the corresponding role Collections, so if you just add the
filterFunction for the userCollection and not others, it will try
to execute the code for other role Collections while that
userDescriptor is already filtered out.



Try that and see what happens. Also, one more thing you can
try is if you are linking to the afcs source ,

inside onItemReceive function in UserManager.as

inside the else if (isCustomFieldDefined(p_evt.nodeName) use

userD = getUserDescriptor(p_evt.item.itemID); instead of
userD = getUserDescriptor(p_evt.item.associatedUserID);



You can do this by subclassing and overridding the
onItemReceive function



Let me know if these solves your problem. Otherwise I will
run on myside and let you know.



Thanks

Regards

Hironmay Basu

Avatar

Level 2
Hi hironmay,

yes i didnt added filter function for any other collection
accept the userCollection and I am not linking to the source i am
linking to afcs component actually so i cant do that.If i do so i
think i will need to recompile the source into swc and then use it
in my application , as i dont have the graphical assets that are
also compiled with the afcs component so this seems to be long
task.

regards,

ATIF

Avatar

Former Community Member
Hi ,



You can add the filter function to other collections and see
what happens.



And you dont need to recompile while linking source, you need
to just add the SDK/src to your project properties ->Flex Build
Path -> Source Path. But you won't be require to do these. Try
what i said above and it should work.

Lastly , if it still doesnt work, paste a small code that
explains your problem and I will run it here locally and let you
know.





Thanks

Hironmay Basu

Avatar

Level 2
Hi Hironmay,

I tried both of the solutions you provided but none of them
work, Although I am attaching this simple code to reproduce the
error.

regards,

ATIF

Avatar

Former Community Member
Hi,



I ran your code , the problem is when you use such a filter
function , your arraycollection's item get removed however, the
source array of the arraycollection still has the item. So, there
is a discrepancy between your source array in arraycollection and
the items in arraycollection. We do our searching of a particular
item while adding/removing it in collection using the source to
find the index and then remove/add it. So, even though the index is
found in arraycollection's source, the item has been filtered out
in the arrayCollection itself and thus throw a range error. This
has nothing to do customField as such and if you want to change
anything in the userDescriptor like setDisplayName,setVoiceStatus
or any other descriptor parameter , it will lead to the same
exception.



I will think what can be done on our side for this and I will
get back to you on it this week. These are things which unless
users like up with an example , hard to discover !



Thanks

Hironmay Basu

Avatar

Level 2
Hi,

yes i can understand setCustomField has nothing to do this
with such range error . I added it only for the example
purpose.Main cause is the orginating difference in arrayCollection
and its source after using filter function.For now what can be its
alternative if i want to filter myself from the users list and only
list the users that are online except me.

regards,

ATIF.

Avatar

Former Community Member
Hi,



You don't use a filter function rather You can maintain your
own List whose dataProvider is an array/arrayCollection without
having your descriptor. You can do this by listening to UserAdd and
UserRemove events in UserManager and maintaining your list or you
can iterate over usercollection when it changes and remove your
descriptor. These are some of the options i would try off.



Thanks

Hironmay Basu