2 Replies Latest reply on Aug 29, 2009 1:22 AM by Barna Biro

    finding an index in array collection based on the item name



      public function showActivity(adata:ArrayCollection):void



      var idx:int;


      var zone:String = adata[0].Zone;


      var at:String = adata[0].ActivityType;



      var view:IViewCursor = zoneCollection.createCursor();


      idx = zoneCollection.getItemIndex(view.findFirst(zone));

      zoneCollection.itemUpdated(zoneCollection[idx].imgSource =

      "images/circle_red.png", zoneCollection[idx].imgSource = "images/circle_green.png");



      What I'm trying to do is take an ArrayCollection, pull out a couple of values, then find one of the values in a different ArrayCollection and get its index.  The point of this is to change an image for an itemrenderer on a datagrid column based on the index.


      Logically, to me this works: idx = zoneCollection.getItemIndex(view.findFirst(zone));


      However, Flex doesn't seem to like that approach.


      Any ideas?


      I don't know if this will help but the real world explanation for this is....


      I have something in one collection, I want to find where that same something is in another collection, and then change something about it.