View Full Version : Reverse Search Index of An Array Element

04-27-2010, 02:48 PM

This seems like a fairly easy problem, but I cannot seem to get the answer to it.

I have a snippet here, and note that regions is an array and not string.

for (var s:String in regions) {
trace("\n" + s);
var index2:int = regions.indexOf(s);
trace(index2); // -1

Is it possible that I can get the trace to print out the index of the element?
If indexOf is not the best function here, do I have other options?

Thanks for your help.