Toxiclab.org

Password section in flash

7.6.2008, 14:17
Submited in: Flash | Total Views: 24761

In this detailed lesson, I will show you how to create a password section using the If and Else Statements. You will also learn how to create password fields, button for password activation, how to use action script panel and much more.



Enter toxiclab as password and click on button!



Step 1

Create a new flash document.



Step 2


Using the flash tools for drawing, draw any shape which will represent a button.



Step 3

While the shape is still selected, press F8 key (Convert to Symbol) to convert this shape into a Button symbol.

 

Step 4

Click now on frame 15 and press F6 key.

Step 5

While you're still on frame 15, take the Selection Tool (V) and click once on the button to select it. After that, go to the Action Script Panel (F9) and enter this code inside the actions panel:

on (release) {
gotoAndStop(1);
}

Step 6

Go back now on the first frame and enter this code inside the actions panel:

on (release) {
gotoAndStop(15);
}

Step 7

Double click on layer 1 to rename its name into a button. After that, create a new layer above the layer button and name it text fields.

Step 8

Select the text fields layer, take the Rectangle Tool (R) and draw the text fields like it is shown on the picture below.



Step 9

Takle the Text Tool (A) and go to the Properties Panel again (Ctrl+F3) and select the following options:

a) Select a Input Text field.
b) Select any font.
c) Choose any size for font.
d) Select any color for font.
e) As the rendering option, select Anti - alias for readability.
f) for Var type: inputName



Then, draw a rectangle over the text fields.



Step 10

Click now on frame 15 and press F6 key.

Step 11

After that, select just the text fields and delete it.



Step 12

While you're still on frame 15, select the input field and go again to the Properties Panel (Ctrl+F3) below the stage. Then, change the Input text into a Dynamic and for Var type:answer. See the picture below.



Step 13

Create a new layer above the layer text fields and name it labels.

Step 14

Select now the labels layer and type "enter your password:"



Step 15

Click now on frame 15 and press F7 key.



Step 16

Create now a new layer above the layer labels and name it action.

Step 17

Select the first frame of layer action, go to the action script panel (F9) and enter this code inside the actions panel:

stop();

Step 18

Click now on frame 15 and press F6 key. While you're still on frame 15, go again to the action script panel (F9) and enter this code inside the actions panel:

password = inputName

if (password == "toxiclab") {
answer = "Access granted!" ;
} else {
answer = "Access denied!" ;
}

We're done!

Test your Movie and enjoy!

Download example

Are you a website owner?
Click here to register and submit your tutorials!

Browse by category


Most popular tutorials