A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Alphabetize with Flash 5

  1. #1
    I made a website for my friend's band and the News, Shows, and Links sections are designed so he can update them himself from his browser. My problem is that I would like to be able to alphabetize the links so that there is some order to the page.

    When a visitor clicks the Links button, variables are loaded from a text file via php. The variables are "Name" (the band name) and "Website" (the url the "name" will take the visitor). The dynamic text box that displays this is called "links".

    Any ideas? I'm using Flash 5. Thanks

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044

  3. #3

    Sweet

    Thank you. That is a very helpful site there. I appreciate it.

  4. #4
    Senior Member
    Join Date
    Mar 2002
    Posts
    161
    Though PHP will probably be fastest, you can also sort arrays in ActionScript after loading from the txt file. Check your AS Dictionary under Array.sort()

    Jerry

  5. #5

    determination

    I think I understand now how to utilize the sort function. What I can't seem to do is make flash determine how many variables are residing in the dynamic text box named "links". Since all of the variables are called from a text file and named "Name" the only distinction is the the value of each variable. The values consist of a band name and a url. Since the variable "name" is displayed in the text field many times and has many different values, how do I tell flash to count them and look only at the displayed band name and not the variables moniker?

    Whew.

  6. #6
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    if you are using backend scripting, you can just ignore the problem...
    Your "text file" (could be output from script as well) would read
    links=<a href=....>name</a><br>
    <a href=....>name</a><br>
    <a href=....>name</a><br>

    If you want to sort in flash, your text file could read
    link1=....&name1=....&link2=....&name2=....&count= 2

    Obviously the former format only works with a html textbox (that could have a scroll bar), while the second one could be used nicely if you want to duplicate buttons for those links.

    Musicman

  7. #7
    Senior Member
    Join Date
    Mar 2002
    Posts
    161
    If your data is formatted similar to this:

    Name=RobertName=JerryName=Wolgang

    You can split the data at "Name=" and then use sort on the returned array.

    Code:
    stuff=textfieldName.split("Name=");
    stuff.sort();
    Jerry

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