开发者

Flex: CollectionChangeEvent cannot be triggered by removeAll()

the code is like the following:


[Bindable]
p开发者_如何学Goublic var abc_list:ArrayCollection;

...

this.abc_list.removeAll();
this.abc_list.addAll(otherCollection);

...

this.abclist.addEventListener(CollectionChangeEvent.COLLECTION_CHANGE, onCollectionChange)

I found that the event cannot be triggered after the moment of removeAll(), but it works well in addAll(otherCollection) [with event.type].

So the original list is not removed before the new list is added;And the abc_list is actually accumulated?!

Why is it happen? and What can I do with that?


May be hacky and I'm thinking this out loud as I haven't checked it

this.abc_list.removeAll();
this.abc_list.refresh()

and wait for a CollectionEvent event with the CollectionEventKind.REFRESH upon refresh


*this.abclist.addEventListener(CollectionChangeEvent.COLLECTION_CHANGE, onCollectionChange)*

Is it custom event ?

I am using CollectionEvent.COLLECTION_CHANGE and it works fine with removeAll() method. I hope using CollectionEvent.COLLECTION_CHANGE solves your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜