开发者

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 ArrayCollections 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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜