When to use ArrayCollection or Array in as3?
I know that an ArrayCollection
is a wrapper 开发者_JAVA百科over an Array
, but what I wanted to know is when to choose one over the other? Will the over usage of ArrayCollection
s result in performance?
The main advantage of ArrayCollection
is collectionChange
event which allows to get advantage of data binding with it.
Some others are:
- Possibility to filter or sort elements of collection without modifying or copying of underlying array.
- Implementation of
ICollectionView
which allows to create a cursor and iterate collection with it. - Display of multiple arrays in a datagrid / etc (in this case, arrays are automatically converted to arrayCollections anyway)
If you don't need any of these advantages use simple Array
.
精彩评论