Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-27-2010, 02:48 PM   #1
Alice the Newbie
Join Date: Jan 2009
Posts: 128
Question Reverse Search Index of An Array Element


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.

ActionScript Code:
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.
ajwei810192 is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 01:46 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.