Flex: Problem with CollectionEvent on ArrayCollection
- by dasnervtdoch
Hi there,
got a reference to an arrayCollection and add event listener like this:
collection.addEventListener(CollectionEvent.COLLECTION_CHANGE, onCollectionChange);
that´s fine. Now some other component does have the same reference and is adding items to and removing items from that collection. Each time the handler is called:
private function onProjectPersonsChange(event:Event):void
{
if (event.kind == CollectionEventKind.ADD)
{
//do something
}
else if (event.kind == CollectionEventKind.REMOVE)
{
//do something
//here is the problem: event.items.length = 0
}
else
{
trace('CollectionEvent: kind not handled!');
}
}
Does somebody know why the removed item is not in 'items'?
Thanks in advance!