4 Replies Latest reply on May 16, 2008 12:45 PM by clbeech

    user name script not working

    marknestor Level 1
      I found this code online to setup a username/password just within flash. problem is that even when the correct username is entered, it doesn't accept it. still treats it as incorrect. Is there something weird with this code?


        • 1. Re: user name script not working
          kglad Adobe Community Professional & MVP
          1. || is the or operator, not |.

          2. the isWhiteSpace() method for strings needs to be defined

          3. nextcheck() needs to be defined.

          4. UserName must be "client"
          • 2. Re: user name script not working
            marknestor Level 1
            sorry, here's the script on frame 1:

            // This is a global function that checks the input boxes are not just all spaces
            String.prototype.isWhiteSpace = function() {
            return ((this != undefined && this.length>0) ? (this.split(" ").join("").length == 0 ? b=true : b=false) : (b=false));
            };

            // This clears the input boxes so that if the user logs in a second time the old information is deleted.
            var UserName = "";
            var Password = "";

            // This sets the default starting message when the movie first loads
            var Guide = "Please Enter Your User Name And Password";

            // Declares a global function which can be called any time from any where in the flash movie
            _global.nextcheck = function() {

            // Checks the password to see if anything has been typed in or if it is empty
            if (Password.length == 0 | Password.length == "" | Password eq "") {

            // Alerts the user that their password is incorrect
            Guide = "No Password Entered Please Try Again";

            // Stops the movie from going to the next frame
            stop();

            // Checks to see if the password is only full of spaces
            } else if (Password.isWhiteSpace()){

            // Alerts the user that their password is incorrect
            Guide = "Sorry Incorrect Password Entered Please Try Again";

            // Stops the movie from going to the next frame
            stop();

            // Checks to see if the password is right or not
            } else if (Password=="password") {

            // If the password is correct movie on to the next frame of the movie
            nextFrame();

            } else {

            // If the password is wrong then alert the user that it's wrong
            Guide = "Sorry Incorrect Password Entered Please Try Again";

            // Stops the movie from going to the next frame
            stop();
            }
            };
            // Stops the movie from going to the next frame
            stop();
            • 3. Re: user name script not working
              kglad Adobe Community Professional & MVP
              ok, so that takes care of 2 and 3.
              • 4. Re: user name script not working
                clbeech Level 3
                maybe it needs another stop() or two...