Written by: WORCESTER , email
Difficulty Level: Beginner
Requirements: Flash 5 or higher Download FLA

PASSWORD PROTECTION for the Paranoid!
There is only one correct password that will grant you access to the "secure data."
All that will be visible (until the correct password is entered) is white,
to ensure that people can't guess each letter individually.
If one letter is entered incorrectly, the page/file must be reopened, or you can't get in.
**Just to put the probability of "someone cracking your code" into perspective, the chance that this could happen to a 12-key password is 1 in every 540,360,087,662,636,962,890,625.**
For this example, click on the box below and type in the password. (The password is "monkey.")


On your first frame, put a stop(); action on it.
Create a movie clip (Ctrl+F8) called "movieClip", (make sure the instance name is also "movieClip") and we'll have all the On your first frame, put a stop(); action on it.
Create a movie clip (Ctrl+F8) called "movieClip", (make sure the instance name is also "movieClip") and we'll have all the workings in it.
(This makes it impossible to Control -> Step Forward in the Flash player.)
Place this movieClip on the stage and edit it, setting up 2 layers. On layer 2, frame 1, create another movie clip called "01". Put this ActionScript on the movie clip "01":

onClipEvent (keyDown) {
        if (Key.isDown(77)) {
                _root.movieClip.gotoAndPlay(2);
        }
        else {
                _root.movieClip.gotoAndPlay(8);
        }
}

The text that is in red must be changed for each frame.
          The 77 will be changed to 79, then 78, then 75, then 69, then 89. "Why?" you may ask.
The answer is simple. If you go to Flash Help, and look under "Keyboard Values and Key Code Values," you will find that 77 means "m," 79 means "o," and so on to spell out "monkey" (which will be the password neccesary to get to our "secure data.")

Download code generator

          Now all you have to do is copy the frame and paste it five times. Each time, change my red 77 to the correct code, put a stop(); action on each frame, and change the " gotoAndPlay (2);" to the next number. (Change the "2" to a "3", then 4, then 5, etc.)

CHECKPOINT:
          You should now have a total of six frames in your movieClip, each with a stop(); action on it. Got it? Good!

          Create a new frame at the end as your seventh frame. Put a stop(); action on it. Now you can put a picture, a text message, or anything you want on the stage, preferrably on Layer 1 to keep everything seperated and easy to manage. (This is your "secure data".)

          Create an eighth frame, with nothing on or in it. Put a stop(); action on it. (This is the place where any incorrect key presses sends you ( key purgatory ). If you put anything on it, it will give away the fact that their keypress was wrong.)


Now you're done! Enjoy your security!


OPTIONAL:
1.        You can add more frames between the seventh and eighth frames to add more pictues or text. Just remember to change the _root .movieClip. gotoAndPlay ( 8 ); to the number of your last frame, be it 9 or 1000000.

2.       Also, you can do this to allow the screen to black out at the touch of a button:

Add this script to the actions of the movie clip "01" on the frames that have your "secure information" on them:

onClipEvent ( keyDown ) {
        if ( Key . isDown ()) {
        }
        else {
                _root .movieClip. gotoAndPlay ( 9 );
        }
}

Just change the "9" to whatever frame you want to act as the detour (it's best to have it close to the last frame, or the last frame itself; NOT the previously mentioned key purgatory .)

Now on this frame, you can create a secondary password, like the first couple frames (as long or short as you want). Just make sure you have the target go back to frame 7, so you can continue viewing your "secure information."