Wednesday, February 18, 2009

Password

You probably have seen passwords on flash games before. Wonder how it works ?
Well, i will teach you the easy way to do that.
Firstly create 3 empty keyframes and give all of them the action stop();

On first frame, make an imput text box and give it the INSTANCE name of "mypassword"
Now make a button and give it this actions:

on (release) {
if (mypassword.text.indexOf("matrix") != -1) {
_root.nextFrame();
} else {
_root.gotoAndStop(3);
}
}

In this case (that's the code from my example) the person would have to type matrix to move on, but you can change that to whatever you want.
On second frame make whatever you want to happen if the password is right, and on third if the password is wrong. Again, you can change this to your needs.

here is what i've done:





0 comments:

Post a Comment