1 Reply Latest reply on Nov 9, 2009 6:38 PM by Turt2

    "undefined" in loadVariables

    Turt2

      Ok, this is what i want to do:

       

      I have 1 button, 3 text feilds

      the button simply says "click me"

      the first text feild says "You are number"

      the second is blank

      the third is "to click that button"

       

      i also have 1 php file that read/writes to file

      (its hard to explain, so here is the code:)

       

      <?php  

      $file = "button_clicks.txt";
      $data = file($file);
      $line = $data[count($data)-1];
      $dataEnter = ($line + 1)."\n";
      $fileOne = $file;
      $myFileTwo = $file;
      $fhTwo = fopen($myFileTwo, 'a') or die("ERROR FILE CANNOT BE WRITTEN");
      $stringDataTwo = $dataEnter;
      fwrite($fhTwo, $stringDataTwo);
      fclose($fhTwo);
      $fileTHR = $file
      $dataTHR = file($fileTHR);
      $lineTHR = $dataTHR[count($dataTHR)-1];

      ?>

       

      What that does is it opens the file, reads the last line, adds 1 to the number, writes it to the file on the next line, and then reads the line to output it (i originally used this for a webpage ihad to make my own "hit counter")

       

      What i need to know is:

       

      How can i make "textfield 2" have a set value (text) of the last line of the file.

       

      OR

       

      When the button is clicked, how can i get textfield 2 to load that PHP file, and set it's value (textfield2) to that line.

       

      I have tried this code:

       

      on (release) {

      s = loadVariablesNum("button.php","");
      this.number = s;
      }

       

      and so far it sets the text to "undefined" with no errors in compiler or output boxes.

       

      i have tried testing this on my webpage, on my computer, and in flash. None of which change the output.

       

      If any code changes to my PHP, AS2 or other files are needed, please let me know..

       

       

      Thank You