1 Reply Latest reply on Nov 29, 2010 6:39 PM by foolish3737

    Query elements of an ArrayCollection dynamically?

    foolish3737 Level 1

      I'm trying to filter an ArrayCollection without having to write a bunch of filter functions. What I'd like to do is have a dynamic query (or syntax).

       

      Something like this:

       

      private var query:String = new String("name");
      
      
      private function removeDuplicates(item:Object):Boolean
      {
           var retVal:Boolean = false;
           var tempObj:Object = {};
           if (!tempObj.hasOwnProperty(item.query)) {
                tempObj[item.query] = item;
                retVal = true;
           }
           return retVal;
      }
      
      
      

       

      Obviously I can't just append a string variable to an Object dot syntax. Any idea how I might go about this?