First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
Search tutorials
Author: Vlad Craita | Website: http://www.coolsoft.home.ro

Insert an 'evaluate' action(Esc+ev) and type in mess="Invalid password!". When you type the wrong password or you don't type anything you will be alerted that it's an invalid password.

Insert another 'if' action and type in password=="tutorial" - now the password for the username "flashkit" is "tutorial"..

I guess you've noticed that we need to insert another 'evaluate' action. So press 'Esc+ev' and type in mess="You forgot your username!". When you type a wrong username or when you don't type a username you'll be alerted that you forgot your username.

For the end we must insert another 'if' action. Press 'Esc+if' then type in the text field the following: username=="flashkit" & password=="tutorial" then insert an 'evaluate' action and write in mess="Welcome " + username. By doing this the text typed in the variable 'username' is loaded in the variable 'mess'. If you want another final action, maybe a 'getURL'(Esc+gu) action, you must insert a 'getURL'(Esc+gu) action where you type the url and the target(' _self' specifies the current frame in the current window; '_blank' specifies a new window; '_parent' specifies the parent of the current frame; '_top' specifies the top-level frame in the current window.) but also the variable used(POST or GET).

Here is the code:

on (release, keyPress "") {
    mess="Sign in please!";
    if (username=="flashkit" ) {
        mess="Invalid password!!";
    }
    if (password=="tutorial") {
        mess="You forgot the username!";
    }
    if (username=="flashkit" & password=="tutorial") {
        mess="Welcome  " +  username;
    }
}

Note: If you want to introduce another user you'll have to modify a little the actionscript. Can you guess what are the changes. I'll show you anyway. Here are the changes:
on (release, keyPress "") {
    mess="Sign in please!";
    if (username=="flashkit" or username=="vlad") {
        mess="Invalid password!!";
    }
    if (password=="tutorial" or password=="romania") {
        mess="You forgot the username!";
    }
    if (username=="flashkit" & password=="tutorial" or username=="vlad" & password=="romania") {
        mess="Welcome  " +  username;
    }
}

We used the 'or' action. - condition1 'or'condition2

» Level Intermediate

Added: 2002-09-21
Rating: 7.88 Votes: 176
(10 being the highest)
» Author
I'm a 17 year old boy who has spent the last 2 years animating in Flash. I live in Romania, i design web pages and i love to surf on the internet.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: doc_chin7
» Description:

The flash's horizontal road drive was done in CS4 and was upgraded to CS6. The car responds to right/ left key and flash will auto-generate the movement of roads from left-right or right-left based on random number. Have fun driving in this virtual environment and avoid other cars... :) If you are creative, a road driving game can be created from it.

Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.