A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: array sort by value - easy?

Threaded View

  1. #1
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472

    array sort by value - easy?

    hi there,

    I pulling data from a DB split it into to array and now I would like to sort it depending on a specific value.

    myArr[0] = ["nameA",0,"mail"]
    myArr[1] = ["nameB",2,"mail"]
    myArr[2] = ["nameC",1,"mail"]
    myArr[3] = ["nameD1",1,"mail"]
    myArr[4] = ["nameE",0,"mail"]
    myArr[5] = ["nameF",2,"mail"]

    I would like to sort the array depending on the second value.
    All values of '1' should go first. Followed by all values of '0' and then all values of '2'.

    To make it look like this
    myArr[0] = ["nameC",1,"mail"]
    myArr[1] = ["nameD",1,"mail"]
    myArr[2] = ["nameA",0,"mail"]
    myArr[3] = ["nameE",0,"mail"]
    myArr[4] = ["nameB",2,"mail"]
    myArr[5] = ["nameF",2,"mail"]

    Am I making myself understandable?

    Regards
    //PODEN
    Last edited by podenphant; 08-13-2003 at 07:31 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center