indexOf question

hi,

indexOf() is useful for finding the index number of an element in an array, but what should be the method when the element occurs more than once and we want to get all the index numbers?

I thought such an approach would work, doesn’t seem to:

var index:int = array.indexOf(“word”);
trace(index);
var index2:int = array.indexOf(“word”, index);
trace(index2)

thanks.