2011-08-05 3 views
1

나는 드롭을 허용 목록이 있습니다. 항목이 삭제 될 때 (DragEvent.DRAG_DROP) 삭제 된 데이터를 수집해야하지만, 도움이되는 이벤트에서 아무 것도 찾지 못했습니다. event.dragInitiator.selectedItems이 작동하지만 오류가 발생합니다.플렉스 드래그 된 데이터 감지

도움을 주시면 감사하겠습니다.

답변

2

데이터는 event.dragSource이어야합니다. hasFormat()을 사용하여 올바른 형식을 확인하고 dataForFormat()으로 검색해야합니다. 다음은 DragSource의 문서입니다.

// In dragDrop handler or dragComplete 
if (event.dragSource.hasFormat("itemsByIndex")) 
{ 
    var items:Vector.<Object> = event.dragSource.dataForFormat("itemsByIndex") as Vector.<Object>; 
    // Do stuff with items 
} 
+0

예, 감사했습니다. –

0

또한 dataProvider의 변경을들을 수 있습니다 :

코드는 다음과 같이 (이 플렉스 4 가정) 일 것이다.

list.dataProvider.addEventListener(CollectionEvent.COLLECTION_CHANGE, list_dataProvider_change); 

... 

protected function list_dataProvider_change(e :CollectionEvent) :void 
{ 
    if (e.kind == CollectionEventKind.REMOVE) 
     trace('list element removed from - index', e.location); 
    else if (e.kind == CollectionEventKind.ADD) 
     trace('list element added to - index', e.location); 
} 
관련 문제