Hi, You have to create the copy of ArrayCollection using the Utility.Copy command which we help you to keep the copy of original one and create the copy of existing one.
Apply the filter condition on newly created ArrayCollection. Hope this will help you Regards, ________________________________ Krunal Panchal *[email protected] ________________________________ From: Nick Middleweek <[email protected]> To: [email protected] Sent: Tue, 2 March, 2010 14:13:32 Subject: [flexcoders] Searching through an ArrayCollection of Objects Hi, I was wondering if there are any quick ways to solving this, quick as in CPU time, not developer time... I have an Array Collection of VO's called contact which has two properties.. . var myAC : ArrayCollection = new ArrayCollection( ); var myContact : Contact = new Contact(); myContact.name = "bob"; myContact.age = 30; myAC.addItem( myContact) ; var myContact : Contact = new Contact(); // Also, Is this bad practice? Am I loosing the reference to previous myContatc? I'm sure someone mentioned this to me once on this list? myContact.name = "bill"; myContact.age = 31; myAC.addItem( myContact) ; var myContact : Contact = new Contact(); myContact.name = "sarah"; myContact.age = 28; myAC.addItem( myContact) ; I now want to write a function which takes the ArrayCollection to scan, the name property value of the object and it will return the age property of the first found VO. At the moment, I'm just looping through the collection without sorting them and it all seems to work. I've had a look at the Array API and have found sortOn and lastIndexOf( ), etc but am thinking is there a time benefit in sorting first and then looping or is there a super function that does exactly what I want and super efficient? I was thinking is it worth converting to XML then using E4X queries but the conversion is probably time comsuming. In reality myAC will be about 300 elements so maybe a brute force looping scan might be good enough but having started this, I'd like to hear what you others think. Thanks in advance, Nick

