If you have an ArrayCollection with a filter function set and you loop through the items, you’ll only see the items which match the filter. The catch is sometimes you want to see them all. Initially I was doing the following.
var filterFunction:Function = arrayCollection.filterFunction;
arrayCollection.filterFunction = null;
arrayCollection.refresh();
for each (var obj:Object in arrayCollection)
{
// do stuff
}
arrayCollection.filterFunction = filterFunction;
arrayCollection.refresh();
This worked but was pretty ugly. Here’s a nicer approach:
for each (var obj:Object in arrayCollection.source)
{
// do stuff
}
What I keep finding in Flex is that I’m able to come up with complex code to solve simple problems but when I revisit it months later there’s usually a more straight-forward solution.
Hope this helps,
Hillel