If I combine the following 2 functions (accesses by clicking a checkbox), as
result the new array does not contains all items that matches the checkboxes I
selected.


private function clickHandler(event:Event):void
{

//Empty filtered array
selectedOffers.removeAll();
var selCheckbox:CheckBox = CheckBox(event.target);
selCheckboxName = selCheckbox.id;
selCheckboxName = selCheckboxName.substring(1);
// If a checkbox has been selected, we add the corresponding
categoryId to the selectedCategories array.
selCatId = selCheckbox.id.substring(1);
if (selCheckbox.selected){selectedCategories.addItem( selCatId);}
else {
// If a checkbox has been unselected, we remove it from the
selectedCategories array.
var l:int = selectedCategories.length;
for (var i:int; i < l; i++)
{
if (selectedCategories.getItemAt(i) == selCatId)
{
selectedCategories.removeItemAt(i);
break;
}
}
}
if(selectedCategories.length > 0)
{
//Call Category filter
getOffersByCategories(selectedCategories);
}
else
{
selectAll();
}
}


private function getOffersByCategories(selCats:ArrayCollection):voi d
{
var iC:int;
var iSO:int;
while (iC <= selCats.length)
{
while (iSO < Offers.length)
{
if(Offers[iSO].categories.search(selCats[iC]) != -1)
{
selectedOffers.addItem(Offers[iSO]);

}
iSO++;
}
iC++;
}
grdOffers.dataProvider = selectedOffers;
}