4 Replies Latest reply on Apr 24, 2007 1:06 PM by NickTheNameless

    AS Help For Top 5 List

    NickTheNameless Level 1
      I am working on a project that is a web tool that guides users to appropriate links, based on their selections and criteria. I would like for the first frame of this Flash movie to be a "Top 5" list of the links that the tool guided users to. Essentially, everytime a user uses the tool and clicks on the link provided, that link would get a point. The "Top 5" list would display, in order, the links that have the most points.

      I know how to do this using PHP and MySQL, but I'm a little hazy doing it with AS. I don't need the script written out for me (but feel free to, if you feel so inclined), but rather a few tips on what I should search for in the help files. What functions or properties would a "Top 5 List" like this have to use? I can use either a MySQL database or flat file (like a txt file) to store the "point" count, as security is not an issue with this project.

      Any help, guidance, or simple hellos are much appreciated. Thanks!
        • 1. Re: AS Help For Top 5 List
          NickTheNameless Level 1
          ok, so it seems as if this question is too beyond the scope of support for this board's audience. can anyone suggest some other action script forums that may be able to help me?
          • 2. Re: AS Help For Top 5 List
            Optikalefx
            Well, your going to use MySQL to store the numbers. So as long as you have a mysql database at your fingertips your good.

            to send variables into flash you have to echo "&varname=" . $phpvar;
            and then use this.loadVariables("url","POST"); to get the variables
            then u can use the variables as if (varname >= 5) { do somethign};

            your going to have think of an algorithm to display the top 5 list, like if something is more than the other display it at the top or whatever. So, if you have a more specifi how to question, Id more than happy to help you out, i know this is very well possible but im just not sure where you are with the AS. basically your doing it all in php and mysql and then using flash to display it, so just get the varibles into flash and use them as numbers.

            if you think about it, the best way would be to set the nubmers in the mysql as intergers, and when they click a llink it UPDATES the table to increment it one more, then when u load the database have it ORDER BY ASC and limit it to 5 so that all falsh does is show exactly what php has echoed.

            to send variables from flash to php, use this.loadVariables again.
            this.onRelease = function() {
            this.vartophp = "whatever u want sent";
            this.loadVariables("url","POST");
            }
            and then write an update php sql file
            • 3. Re: AS Help For Top 5 List
              Optikalefx Level 1
              if you still are shady where i wrote "whatever u want sent" make that fill a dynamic text box on the button your clicking so that whenever you load the database it changs two things.

              the dynamic text box to display to the user, and the getURL("") so u know what to click


              I have thoroughly confused you i bet.

              lemme back track.

              make a table in a database that has 2 columns, integer and varchar
              the integer is the points, and the varchar is the URL of the link

              in flash have a set of 5 buttons each with a dynamic text box in them.

              in the AS have 5 variables that set the dynamic text boxes AND set the getURL("");

              in php use a for loop to echo each of the top 5 urls with a differnt "&whatever". so i hope you know how to do that like &var . $i so that it displays this:
              &url1=http://www.url1.com
              &url2=http://www.url1.com
              &url3=http://www.url1.com
              &url4=http://www.url1.com
              &url5=http://www.url1.com

              in flash name the buttons button1_btn, button2_btn..etc.
              also in each button have the variable name of the dynamic text box be url1 url2 url 3 ect.
              this.loadVariables("url of php file","POST");

              button1_btn.onRelease = function() {
              button1._btn.getURL(url1);
              }
              button2_btn.onRelease = function() {
              button2._btn.getURL(url2);
              }
              button3_btn.onRelease = function() {
              button3._btn.getURL(url3);
              }


              if you have trouble getting the getURLs to work, you need to wait for the data to be loaded, so look in previous posts iv writtent to other people b4 how to do that.
              • 4. Re: AS Help For Top 5 List
                NickTheNameless Level 1
                this makes sense, thanks. i was imagining that AS could perform backend operations, like php. learn sumthin new everyday.

                so i still write a php script to manipulate the info in the database, and Flash just displays it. that works for me, thanks again.