Wednesday, June 22, 2011
Web Technologies: Fast Flex Array Search
Web Technologies: Fast Flex Array Search: "private function findInCollection ( c : ArrayCollection , findFunction : Function ): Array { var matches : Array = c . source . f..."
Fast Flex Array Search
private function findInCollection(c:ArrayCollection, findFunction:Function):Array { var matches : Array = c.source.filter( findFunction ); return matches; } private function findFunction(propertyName:String,propertyValue:*):Function { return function( element : *, index : int, array : Array ) : Boolean { return element[propertyName] == propertyValue; } } Call the function:
var searchedElements:Array=findInCollection(ac,findFunction('recordId',2));
Subscribe to:
Posts (Atom)