You can sort your ArrayCollection by Name attribute (using new Sort() and SortFields() objects). And then use a search algorithm like a binary search. Binary search another search algorithms are readily available so I will not repeat info here.
This is only useful if you have a lot of records (10 000+), though. If you have less than that, then the speed for searching records between FOR loops and other algorithms won't differ by much, nor worth your time to implement. This is what I was taught by my professor. I've never benchmark tested this but since the guy holds a PhD in Comp. Sci., I will trust his judgment. :) Happy coding. --- In [email protected], "flexawesome" <[EMAIL PROTECTED]> wrote: > > Hey there, > > I had an ArrayCollection and I need to check if name = "carry" is exist in the > ArrayCollection. > > I could use objs.source.forEach() to loop the arrayCollection, is there any fast way can do > this as well? > > Cheers > > public var objs:ArrayCollection = new ArrayCollection(); > > var obj:Object = new Object(); > obj.id = "123"; > obj.name = "carry"; > objs.addItem(obj); > > obj = new Object(); > obj.id = "198"; > obj.name = "fred"; > objs.addItem(obj); > > obj = new Object(); > obj.id = "223"; > obj.name = "henry"; > objs.addItem(obj); > > obj = new Object(); > obj.id = "872"; > obj.name = "tom"; > objs.addItem(obj); > > obj = new Object(); > obj.id = "190"; > obj.name = "tom2"; > objs.addItem(obj); >

