Have a site containing information you want to keep protected? If yes, then this simple tutorial is for you. What we are going to do is construct a Username and Password processor, which sounds complicated, but it's not. In fact, I just happened to accidentally make it up a few moments ago, and was so impressed with myself, I decided to let you in on the secret.
Now, first thing first, you will only need one layer, one frame, and one scene to do this, so just open Flash and get all your text and actions panels out and ready.
First, select the Text Panel (Window, Panels, Text Options), and click on the 'Text Op' tab. The scroll down menu there probably says 'Static Text'. Click it and set it to 'Dynamic Text'. A few new options should now appear. Make sure that the second scroll down menu is set to 'Single Line', that HTML, Border/Bg, and Selectable are all unchecked (so they can't see your password), and click on the first button ( [...] ) under Embed fonts so that all the other buttons "freeze".
Now, go back to the Character tab and make sure that your font colour matches the colour of your background so that the writing appears invisible, drag yourself a text box.
Go back to 'Text Op' and make sure that Selectable hasn't checked itself, and if it has, UNCHECK IT! The text box marked 'Variable' will probably read something like "TextField1", but you must rename it. In this demo, we will call it 'counter', because that's what I called it in my .fla file, and if you want to download that and check it, we don't want there to be a different name there.
You are now done the first and most complicated text field.
Now, we will make a second and third, both of which will be much easier.
Drag a new text field onto the stage. Select it, and then go back to the good old Text Panel and and where it said 'Dynamic Text', we will now set to 'Input Text'. Once again, embed all the fonts, but this time, leave selectable checked, and under the Character tab, put the text to a colour we can see.
Once that is all set up, name the Variable 'one'.
Copy and Paste 'one' and put the copy just below it. Go to the Text Panel for that one, set it's variable to 'two', and where the menu says Single Line, set it to Password. This will make whatever you type in come out in Asterix', like in most password applications.
You might want to put a little box with no center around your text boxes (not the first one that's invisible) so that you can find them easily when you test and poublish the movie.
Now for the button. This is the brain of the entire movie. Draw any old circle or whatever you please, and make it a button by pressing F8 and selecting 'Button' from the Behavior options. Once you have done that, select the button and go to it's actions window.
Click on the + sign and go to Actions. Under Actions, click on Set Variable. Two text fields should now appear. In the first, type in 'counter', the name of the invisible text field, and in the second area, type in one+two and checkmark the Expression box.
Now, click the + sign again, go to Actions, and click on 'if'. In the window that shows your code, drag the 'if' to the bottom so that it has it's own 'On Release' action. Select 'if', and in it's Condition box, type in 'counter eq "yournameyourpass"'. Now click the plus sign and select what you want it to do when you put in the right username and password, i.e. gotoAndPlay frame whatever, or Load Movie, or GetURL, etc... Where I wrote "yournameyourpass", replace yourname with the login name you want them to put in the top box and replace yourpass with the password you want them to put in the bottom box.
Your now nearly done. Select the last action, i.e. gotoAndPlay or whatever you put and press the + sign again. Select 'else'. This is just if you want something to happen if they get the username, password, or both wrong. After 'else' put the action for whatever you want to have happen.
Your Done! Good work! Test your work, and if something isn't right, download my file and check my code. It's all pretty obvious.
|» Level Basic|
Rating: 8 Votes: 64
|Brought to you by H.D.E Web Creations, a branch of Howells Daly Enterprises.|
|Download the files used in this tutorial.|
|Download (4 kb)|
|More help? Search our boards for quick answers!|