This is a code that is very simple to make and allows you to have passwords for your games. Why would you want to have passwords? Well, if you're making a game, it acts like a save alternative. In a 5 level platformer game, you really don't need a save feature but a password feature would be helpful. If you are making a site in flash, passwords will keep people from accessing certain parts of your site that only you and other admins can access. So open up flash and lets get started! What you need to do first, is create a textbox that you want to be the spot for people to enter their password. Then, once you have that done, go to the document properties and make sure that the textbox is in "input text" format. After you have done that, change the variable name to "password" without the quotes. Then, (this is optional) go to the little box where it says "single line" and change that to "password". Now, create the submit button that you want the user to press after he/she has inputed the password. Give it these actions:
on (press) {
if(_root.pass=="password") {
gotoAndPlay (2);
}else {
gotoAndPlay (3);
}
}
Remember, you can change on (press) to on (release). To change the password from "password" to what ever you want, change password to what ever you want (except numbers) and make sure it's between the quotes. You can also change 2 and 3 to whatever frame numbers you want. If you want a number password, remove the quotes around password and add a number. Test your movie and you will see that you can enter your password and it will take you to frame 2. The else statement is basically saying that if the password is wrong, it will go to the "wrong frame". Oh, if you don't want people to cheat your password, add this code on the first frame of the main timeline:
Stage.showMenu=false;
That will disable the right-click options from your movie. I hope this helps you with your future games/movies!