Vectorials
Flash Perfection
3D Lessons
Tutorialkit
Markup Tutorials
Learn PHP
network
Flash & Swish  Home Flash & Swish Flash Tutorials How to Create an Easy Login System
rss

How to Create an Easy Login System

Author: Stian Bakkane More by this author


If you're new to variables or functions in flash, pelase read the tutorials about them in the tutorials archive.

Create a new flash document (Ctrl - N).

Rename layer 1 to "actions". This is where we'll apply the script.

image 1

Create a new layer and name it "input_text". This is where we'll put the username and password text boxes.

image 2

Create another layer. This time name it "static_text". This is where we'll put the login success or failure messages and so on.

image 3

In the "static_text" layer, create three static text boxes just like I've done:

image 4

Select the "input_text" layer and create an "input text" field. To set the text field to "input text", just do like this:

image 5

Make sure that you set the text field border to on. You can find the border button in the bottom right corner of the image above.

Before you continue, you may want to lock the "static_text" layer.

Create a text field as shown below:

image 6

Select the text field you just created and set the variable name to "user_input". This is done in the properties tab as shown below:

image 7

Repeat the process to cerate a password field. Just make sure you select "Password" as shown below:

image 8

Select the newly created text field.

image 9

Set the variable name to "pass_input".

Unlock the "static_text" layer and lock the "input_text" layer.

In the "static_text" layer, insert new keyframes at frame 2 and 3. Delete the content in the newly created frames.

image 10

Select the "actions" layer and insert keyframes at frame 2 and 3.

Select frame 1 in the "actions" layer and open the "Actions" panel.

image 11

In the first line write "stop();".

image 12

In line 2 and 3 we set the username and password variables to zero, or empty. Because we want the user to input the username and the password, not the program.

image 13

Let's create the login button.

Close the actions panel and select the "static_text" layer.

Select the "Login" text. Right click on it and select "Convert to symbol".

image 14

Make it a button and set the name to "login_button".

image 15

Select the newly created button.

image 16

Set the instance name to "login_button" in the properties panel.

image 17

Select frame 1 in the "actions" layer and open the actions panel again.

In line 4 we create the onRelease function. This function will determine what will happen when we push the login button.

image 18

As you can see, the first word is the instance name of our login button. So this function will be applied to it.

If you don't know what I'm talking about here, please read the Intro to functions tutorial.

image 19

As you can see, I've added a whole bunch of words within the onRelease function. If you're not completely new to Action Scripting, this should look familiar.

But if you're not, I'm going to explain the basics here.

We begin by asking a question. An "If" question. It's basically like this: If the username is User1 and the password is mypassword, then goto and stop at frame 2. If it isn't, then goto and stop at frame 3.

So right here we set the username to "User1" and the password to "mypassword". So that's the values the user has to enter to gain access to frame 2. You may of course change this to whatever you want.

Having done that, let's move on.

Close the actions panel and select frame 2 in the "static_text" layer.

Create a logged in message or something that confirms that the login process was successful.

I created a static text field saying "You're logged in!".

image 20

Do the same thing at frame 3, just make it a login failed message.

image 21

And that's it! You can test the movie (Ctrl-Enter).

If you type in "User1" as username and "mypassword" as password you will get to frame 2. Anything else will send you to frame 3.



Author's URL: www.photoshopaid.net

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 "How to Create an Easy Login System"