1 Reply Latest reply on Jul 22, 2007 1:17 AM by sneakyimp

    Flash and PHP actionscript

    3tBSI Level 1
      I have a login form (i have a mysql database and everything set up) and the login button simply has the AS:

      on (release) {
      loadVariablesNum("login.php", 0, "POST");
      }

      but i don't know what else to add to make it so if you're a registered user (which i already have a form of) then it will go to the next frame, and if not registered, it keeps unregistered users out.

      please help, thanks
        • 1. Re: Flash and PHP actionscript
          sneakyimp Level 2
          first off, i wouldn't put any code directly on a button. it might seem easy to you now, but in the future you will probably find yourself wondering where the code is. it's much better to have all your code in a single frame on the main timeline.

          second, don't use loadVariablesNum(). Try using LoadVars.sendAndLoad() instead. Assuming you have given your login button an instance name of 'loginButton', it might look something like this:

          var submitListener:Object = new Object();
          submitListener.click = function(evt:Object) {
          var result_lv:LoadVars = new LoadVars();
          result_lv.onLoad = function(success:Boolean) {
          if (success) {
          for (varName in result_lv) {
          trace(varName + '=' + result_lv[varName]);
          }
          } else {
          trace("Error connecting to server.");
          }
          };
          var send_lv:LoadVars = new LoadVars();
          send_lv.username = 'myUsername';
          send_lv.password = 'myPassword';
          send_lv.sendAndLoad("https://yourdomain.com/login.php", result_lv, "POST");
          };
          loginButton.addEventListener("click", submitListener);