adv banner
Flash & Swish  Home Flash & Swish Flash Tutorials Password Verification
rss

Password Verification

Author: AEvision More by this author


In this tutorial you're going to learn how to create a password varification system in flash.

Password is: flash

Important notice: This method of password varification does not provided high level of security. Since the verification is client-side, finding out the stored password in the .swf file is not impossible. Therefore, it is strongly advised not to use this method when it comes to very important and sensetive issues. A server-side verification method is the answer in that case.

1:

Ok, the first step is to prepare the interface and distribute the required objects and movie clips on the layers.

image01
Fig 1
  • Create 5 layers as shown in Fig 1.
  • Create an input field using the Text Tool, set it to "Input" type.
  • Create a button for the submission.

The correct/wrong layer will hold our 3 verification results.

The 3 Verification Results:

  1. The Password is correct.
  2. The Input Field is Blank, please enter your password.
  3. The password is wrong!

Those are the three main conditions, place each on a different keyframe. In our case, the 4th, 5th and 6th keyframes represent the correct, blank and wrong conditions respectively.

2:

After completing and placing all the required elements on the stage, we are going now to set a few properties for the input field.

image02
Fig 2
  • As shown in Fig 2, set the Line Type to Password. This will provide visual encryption of the entered password ( *** ).
  • Select the options to make the text selectable and to Show Borders Around Text.
  • Set the Variable to input.

3:

Well done. In this step we are going to set the actions.

image03
Fig 3
  • Select the first keyframe of the "submit" layerand add a "stop" action to it.
  • Select the submit button and add an OnRelease Goto action to frame 3. This is the frame in which the action responsible for all the password verification is.
  • Add a stop action to each of the "Correct/wrong" keyframes.

4:

In this step, the last one, we are going to add the main action script. It is a simple script and should be easy to follow.

image04
Fig 3

Select the 3rd frame of the "Password verification" layer and add the script shown in Fig 4.


Description:
  • Set the value of the input to password
  • If password equals flash, go and play the 4th frame (correct incdication)
  • Else if the password equals to nothing (remember nothing is not between the quotation mark "", which means it's an expression and it does not represent a value that a user would enter) go and play the 6th frame.
    The reason why we did this is because once you load the movie, and hit the submission button without entering any value, flash will consider that a value, as an empty value, and will jump to the "wrong password" indication, therefore we have added a random expression to avoid that.
  • Else if the password is set to "" go and play the 6th frame.
    That means If the user typed in a value and then completely removed it leaving the input field blank (that's why there's no value between the "") go and play the 6th frame.
  • Else (if all the above condition do not apply) go and play the 5th frame, indicating it's a wrong password.

Conclusion:

What we did:

  • Prepared the interface and the required elements such as the button and the input field.
  • Set the property of the input field.
  • created separate keyframes for the 3 different indications with a stop action to each.
  • Added a Goto action to the button on release, to jump to the main action which is on the 3rd frame.
  • Added the main action to the 3rd frame of the "password verification" layer.


Thank you, hope you enjoyed this tutorial and did not face any troubles :)

Download *.fla



Rate this Material: Bad 1 2 3 4 5 Excellent
print this page tell a friend subscribe to newsletter subscribe to rss

Add comments to "Password Verification"