arrayCollectionへの参照を取得し、次のようなイベントリスナーを追加します。
collection.addEventListener(CollectionEvent.COLLECTION_CHANGE, onCollectionChange);
それはいいです。現在、他のコンポーネントにも同じ参照があり、そのコレクションにアイテムを追加したり、コレクションからアイテムを削除したりしています。ハンドラーが呼び出されるたび:
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!');
}
}
削除されたアイテムが「アイテム」にない理由を誰かが知っていますか?
前もって感謝します!