Flex: Problem with CollectionEvent on ArrayCollection
Posted
by dasnervtdoch
on Stack Overflow
See other posts from Stack Overflow
or by dasnervtdoch
Published on 2010-05-26T15:24:19Z
Indexed on
2010/05/26
15:51 UTC
Read the original article
Hit count: 172
flex
|arraycollection
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!
© Stack Overflow or respective owner