1 Reply Latest reply on Dec 19, 2007 1:47 AM by atta707

    Build/Populate Array Collection

    Chris Ellem - Sydney
      Build/Populate Array Collection from existing array collection selected record

      Does anyone know how to do this?
      I am currently making a remote call to do this but would like to do it in AS if possible.


        • 1. Re: Build/Populate Array Collection
          atta707 Level 2
          Of course you can! How do you define 'selected record'? Let's assume you have a field in the array collection elements that determines whether or not this row would go to the new array collection.

          Old fashioned computer science 101:

          var newList = new ArrayCollection()
          for (var int i; i < oldList.length; i++) {
          if (goodToGo(oldList.getElementAt(i)) {

          of course, you'll need to provide a function called goodToGo(Object):boolean.

          In actionscript however, you can use the Filter that ArrayCollections supports to filter the oldList before putting all it's filtered items to new list. Docs have lot about Filtering array collections.