I have a utility function:
function removeFromArray(item:Object, arr:Array):Object {
for(var i:uint = 0; i < arr.length; i++) {
if(item == arr
) {
arr.splice(i, 1);
return item;
}
}
return -1;
}
This function searches through an array and sees if an item
exists in it, if it does, it removes it and returns a reference to
that item.
This works fine for most things. But I just ran into a
problem where I need to remove an array from an array.
so my array looks like this [ [item1a, item1b], [item2a,
item2b] ]; and i need to remove [item1a, item1b] from it. But
passing in the the array to remove and the full array to remove it
from does not work because i guess of the casting to an object in
the parameters list. Can the functionality i want be used? if so
how?
Kyle