2 Replies Latest reply on Jul 16, 2008 4:29 AM by K0raX

    sendAndLoad problems...

      Ok so after i've done a bit of a search i still havent been able to understand the exact and correct usage of sendAndLoad and the LoadVars class.
      I wanted my visitors to be able to send feedback through a form i made inside Flash, to an external PHP file which sends the email to the local sendmail program (no need for details after this :D )
      In any case, i've used the sendAndLoad in order to do that (i presumed at that time, that it would work) and left it there only to find out now that it doesnt work.
      So my questions are:
      1) How does sendAndLoad and LoadVars work? (no need for in-depth, just enough so i can understand it)
      2) Assume the target file does not exist. Shouldnt it return success as false or does it return null or something like that??

      Here's the code i used in flash (P.S. i'm using different frames in order to animate the Success or Failure response to the user's feedback)

        • 1. Re: sendAndLoad problems...
          you need only one LoadVars-Object:

          on (release) {
          var loadVar = new LoadVars();
          loadVar.onLoad = function(success:Boolean){
          if (success) {
          } else {

          loadVar.foename = foename.text;
          loadVar.surname = surname.text;
          loadVar.email = email.text;
          loadVar.subject = subject.text;
          loadVar.texts = comments.text;
          loadVar.sendAndLoad("email.php", loadVar, "POST");

          This should work.

          • 2. Re: sendAndLoad problems...
            K0raX Level 1
            Thanks a lot Martin, that works well.
            What i had there was after the example from the AS2 help reference.
            Don't know why and by what ideas it used 2 loadvars objects but that's the way they had it.