[flexcoders] Re: removeItemAt combined with getItemAt - Manipulating an arrayCollection

2007-06-04 Thread michaelmatynka
Some more info, and I am getting closer.

I am using the following function, but it returns a value of -1, out of bounds, 
regardless of 
what value I try to get the index of:

public function remItem():void{
fields.removeItemAt(fields.getItemIndex({fieldTag: small, 
value:t}));
}

Remember that the arrayCollection looks like:
private var fields:ArrayCollection = new ArrayCollection([{fieldTag: big, 
value:t}, {fieldTag: 
small, value: t}]);


Does anybody know why getItemIndex would return a value of -1?



[flexcoders] removeItemAt combined with getItemAt - Manipulating an arrayCollection

2007-06-03 Thread michaelmatynka
Hello All, great group here.  Delighted to have stumbled upon it.

I have an arrayCollection which is used to pass info to a function which 
filters an XMLList.  
The arrayCollection, in an ideal world, would change in size and content based 
on user 
selections of a series of checkboxes.  (i.e.  check a box, and add another 
filter criteria to 
the arrayCollection, uncheck the box and the criteria gets removed and the 
filter rerun).

Here is the arrayCollection:
[Bindable]
public var fields:ArrayCollection = new ArrayCollection([{fieldTag: big, 
value:t}, 
{fieldTag: small, value: t}]);

The function in this case would return all items whose node named big AND 
small 
matched t.  

How can I use removeItemAt and getItemAt in a function to pass in 1 argument to 
remove 
an element of the arrayCollection.  Say for example I wanted to remove the 
element whose 
fieldTag was big  but I did not know where it was in the arrayCollection.  
Something like 
this worked when the array was not multidimensional:

fields.removeItemAt(arr.getItemIndex(big);

I would love to put this mess to bed, can anyone shed some light on this?

Thanks a bunch.