2010-05-26 3 views
0

에이 CollectionEvent에 문제가있는 ArrayCollection에 대한 참조를 가지고이 같은 이벤트 리스너를 추가 :플렉스 : 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!'); 
    } 
} 

삭제 된 항목이 '항목'에없는 이유를 아는 사람이 있습니까? 사전에

감사합니다!

답변