2 Replies Latest reply on Jan 9, 2007 2:20 PM by myckelh

    Variables

    myckelh
      I have a generic password validater on my site.
      Basicly I have a MC (Password_MC)
      inside I have 3 feilds and 1 button
      1. Dynamic text field (AlertMessage)
      2. Input Text (UserID)
      3. Input Text (Password)
      4. Button (Log in)

      on the button I have the following code. The reason I have absolute paths, is because it doesent work with
      "this" for some reason.

      all I want to do is validate if they are putting in the correct UI & password. If not write in the dynamic feild they didn't. Or if they don't fill the feilds, say they didn't enter it. Very simple. It can't be this difficult. I have done this in flash 4 in and worked. not sure what I'm missing here.

      what's weird is that it works if I have a charecter in the feilds.



      on(release){
      if(_root.password_MC.UserName=="" or _root.password_MC.Password==null){
      _root.password_MC.AlertMessage=="Please enter user name";
      }
      else if(_root.password_MC.Password=="" or _root.password_MC.Password==null){
      _root.password_MC.AlertMessage=="Please enter Password";
      }
      else if(_root.password_MC.UserName=="Test" or _root.password_MC.Password=="Test1"){
      this._visible=false;
      _root.Applications_MC_AC._visible=true
      }
      else if(_root.password_MC.UserName!="Test" or _root.password_MC.Password!="Test1"){
      _root.password_MC.AlertMessage=="wrong Username & password";

      }
      }

        • 1. Variables
          Marghoob Suleman Level 1
          you shuld use like this... i assume you've assigned a name for "UserName" text filed with "UserName" and password text filed with "Password".
          if(_root.password_MC.UserName.text=="" || _root.password_MC.Password.text==""){
          _root.password_MC.AlertMessage.text=="Please enter user name/Password";
          }

          use "||" rather than "or"

          and so on...
          • 2. Re: Variables
            myckelh Level 1
            thanks.

            i finaly figured out that you have to call the instance name, for it to work. Just incase anyone needs to do the same heres the code taht works.
            Although, I still have not figured out how to make the ENTER key work. I always write it, hoping one day I'll figure it out.


            on(release, keyPress "<Enter>"){
            //See if at least the comment form has been filled
            if (this.sUserID=="" || this.sUserID==null || this.sPassword=="" || this.sPassword==null){
            this.UserID_inst.text="";
            this.Password_inst.text="";
            this.alert_inst.text="Please enter User ID & Password"
            return;
            }
            if (this.sUserID=="fsptraining" && sPassword=="fspsupplier"){
            this._visible=false
            _root.Applications_MC_AC._visible=true
            return;
            }
            // Post the Variables
            if (this.sUserID != "fsptraining" && sPassword != "fspsupplier"){
            this.UserID_inst.text="";
            this.Password_inst.text="";
            this.alert_inst.text="Incorrect User ID or Password";
            return;
            }

            }