1 Reply Latest reply on Mar 31, 2008 7:57 AM by Greg Dove

    LoadVars works but status bar says data loading

    gigasaurus Level 1
      I am using LoadVars to pass form data to a php page that sends an email. Everything seems to work, and the php page successfully returns sent=ok, but the status bar at the bottom continues to say "transferring data from..."

      Could someone please help me figure out how to fix that?

      I'll put a link below to my example, as well as example code.

      Thankyou

      http://bigfins.com/php/form01.html

      stop();
      var message:LoadVars = new LoadVars();
      var messageSent:LoadVars = new LoadVars();
      function checkForm():Boolean {
      var missing:Boolean=false;
      error_firstname_txt.text = error_lastname_txt.text = error_email_txt.text = "";
      if (firstname_txt.text == ""){
      error_firstname_txt.text = "first name required";
      missing = true;
      }
      if (lastname_txt.text == ""){
      error_lastname_txt.text = "last name required";
      missing = true;
      }
      if (email_txt.text.indexOf("@") == -1){
      error_email_txt.text = "valid email required";
      missing = true;
      }
      // if missing is true, return false - else return true
      return missing ? false : true;
      };

      function sendMessage():Void {
      var formOK:Boolean = checkForm();
      if (formOK) {
      message.firstname = firstname_txt.text;
      message.lastname = lastname_txt.text;
      message.email = email_txt.text;
      message.sendAndLoad("form01email.php?cachekiller="+ new Date().getTime(), messageSent);
      gotoAndStop("send");
      };
      };

      submit_btn.onRelease = sendMessage;


      function backToForm():Void {
      gotoAndStop("theForm");
      };

      messageSent.onLoad = function() {
      if (this.sent == "OK") {
      gotoAndStop("thankyou");
      } else {
      gotoAndStop("fail");
      failure_txt.text = this.reason;
      }
      };