Sorting the contents of a list backwards

Ask a Question related to Macromedia Director Lingo, Design and Development.

  1. #1

    Default Sorting the contents of a list backwards

    Is it possible to sort the contents of a list backwards?
    Put the values into an array the opposite way round?


    thanks
    m


    minerale webforumsuser@macromedia.com Guest

  2. Similar Questions and Discussions

    1. Write contents of Dropdown list to a database
      i am dynmically creating a dropdown list and i am wondering how to write the contents of the dropdown list to a database. Purpose: i am creating...
    2. positioning of drop down list contents
      I have created a simple drop down list using the drop down list library behavior which works perfectly -- EXCEPT the list items, instead of...
    3. Another mega list of inspiring Shockwave 3D contents
      I have just been sent this link to a mega list of Shockwave 3D contents. Have a look. It's worth it !...
    4. sorting on hash contents
      Hi, all. Say I have a hash of 4 elements, val and name h = "1,2,3,fred" h = "4,1,2,jack" h = "3,3,4,jill" How do I define:
    5. List all and field names database contents
      I have been provided with a DSN, user name and password for one of my clients sites. I'm not an ASP developer and need to view all the contents...
  3. #2

    Default Re: Sorting the contents of a list backwards

    No, but you could access it the other way round.

    n=count(myList)
    repeat with i=n down to 1
    something(myList[i])
    end repeat

    Andrew
    Andrew Morton Guest

  4. #3

    Default Re: Sorting the contents of a list backwards

    set n = myList.count

    repeat while n > 0
    add myList2, myList[n]
    set n = n - 1
    end repeat

    this assumes that you are copying from myList to myList2

    hth,
    richie


    On Mon, 1 Dec 2003 15:40:30 +0000 (UTC), "minerale"
    [email]webforumsuser@macromedia.com[/email] wrote:
    >Is it possible to sort the contents of a list backwards?
    >Put the values into an array the opposite way round?
    >
    >
    >thanks
    >m
    >
    Richie Bisset Guest

  5. #4

    Default Re: Sorting the contents of a list backwards

    Director's array.sort() doesn't support sorting list backwards.

    You have 2 other options which is comparable in speed.

    1. You can take a look at [url]http://xtras.calu.us/articles1.php[/url] which has an article about sorting a list using the merge sort algorithm. With a little tweak on the > and < comparisons, and other minor changes, this will allow you to costomize your sorting algorithm.

    2. call director's array.sort() on your list. then write a repeat loop that will traverse the list backward, and add each item into a new list. something like

    nTotal = list.count
    reverseList = []
    repeat with i = ntotal down to 1
    reverseList.addAt(list)
    end repeat

    Hope this helps

    Chieh An Lu





    ChiehAnLu webforumsuser@macromedia.com Guest

  6. #5

    Default Re: Sorting the contents of a list backwards

    On 2/12/03 2:40 AM, in article bqfnde$iqe$1@forums.macromedia.com,
    "minerale" <webforumsuser@macromedia.com> wrote:
    > Is it possible to sort the contents of a list backwards?
    > Put the values into an array the opposite way round?
    If speed is important, you can use the PRegEx_Reverse(aList) method provided
    by the free PregEX Xtra ([url]www.openxtras.org[/url]) - its not shockwave safe,
    though.

    Luke

    LukeWig Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139