Search Results

Search found 1 results on 1 pages for 'user1560239'.

Page 1/1 | 1 

  • Sorted array: how to get position before and after using name? as3

    - by user1560239
    I have been working on a project and Stack Overflow has helped me with a few problems so far, so I am very thankful! My question is this: I have an array like this: var records:Object = {}; var arr:Array = [ records["nh"] = { medinc:66303, statename:"New Hampshire"}, records["ct"] = { medinc:65958, statename:"Connecticut"}, records["nj"] = { medinc:65173, statename:"New Jersey"}, records["md"] = { medinc:64596, statename:"Maryland"}, etc... for all 50 states. And then I have the array sorted reverse numerically (descending) like this: arr.sortOn("medinc", Array.NUMERIC); arr.reverse(); Can I call the name of the record (i.e. "nj" for new jersey) and then get the value from the numeric position above and below the record in the array? Basically, medinc is medium income of US states, and I am trying to show a ranking system... a user would click Texas for example, and it would show the medinc value for Texas, along with the state the ranks one position below and the state that ranks one position above in the array. Thanks for your help!

    Read the article

1