Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. import flash.display.*;
  2. import flash.net.*;
  3. import flash.events.*;
  4. import flash.text.*;
  5. import fl.controls.*;
  6.  
  7.  
  8. var login = loginButton;
  9. var register = createAccount;
  10. var forgot = forgotPassword;
  11. var theUser = username;
  12. var thePass = passWord;
  13. var theError = errorText;
  14. var urlVars:URLVariables = new URLVariables();
  15. var phpVars:URLVariables = new URLVariables();
  16. var phpFileRequest:URLRequest = new URLRequest("/controlpanel.php");
  17.  
  18.  
  19.  
  20.  
  21. phpFileRequest.method = URLRequestMethod.POST;
  22. phpFileRequest.data = phpVars;
  23.  
  24. var phpLoader:URLLoader = new URLLoader();
  25. phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
  26. phpLoader.addEventListener(Event.COMPLETE, showResult);
  27.  
  28. phpVars.systemCall = "validateInfo";
  29. phpVars.systemCall = "processLogin";
  30. phpVars.theUser = theUser;
  31. phpVars.thePass = thePass;
  32.  
  33. phpLoader.load(phpFileRequest);
  34.  
  35. createAccount.addEventListener(MouseEvent.MOUSE_DOWN, onCreate);
  36. loginButton.addEventListener(MouseEvent.MOUSE_DOWN, onLogin);
  37. forgotPassword.addEventListener(MouseEvent.MOUSE_DOWN, onForgot);
  38.  
  39.  
  40.  
  41.  
  42. function showResult(e:Event = null) :void {
  43. trace("Result being shown!");
  44.  
  45. }
  46.  
  47. function onForgot(e:MouseEvent) :void {
  48. gotoAndStop(3);
  49.  
  50.  
  51. function onCreate(e:MouseEvent) :void {
  52. gotoAndStop(4);
  53.  
  54. }
  55.  
  56. function onLogin(e:MouseEvent) {
  57. validateInfo();
  58. gotoAndStop(2);
  59.  
  60. }
  61.  
  62.  
  63. function validateInfo(e:Event) {
  64. if(!theUser.length) {
  65. theError.visible = true;
  66. theError = "Oops! Looks like you forgot to enter a Username!";
  67.  
  68. } else if(!thePass.length) {
  69. theError.visible = true;
  70. theError = "Oops! Looks like you forgot to enter a Password!";
  71.  
  72. } else if(!thePass.length && !theUser.length) {
  73. theError.visible = true;
  74. theError = "Oops! Looks like you forgot to enter a Username & Password!";
  75.  
  76. }
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement