Graphic Mania

  • Home
  • Articles
  • Vector Packs
  • Freebies
    • Free Fonts
    • Free Icons
    • Photoshop Brushes
    • Photoshop Patterns
    • Photoshop PSDs
    • Textures
  • Photography ideas
  • Advertising Ideas
  • Image Cropper
  • Inspiration
    • Illustration
    • Showcases
  • Resources
    • News
    • Reviews
    • Contests
    • Adobe exams
    • Logo design
    • Wallpapers
    • 3D
  • Web
    • WordPress
  • Tutorials
    • Flash tutorials
    • HTML5
    • Illustrator tutorials
    • Photoshop tutorials

How To Create A Flash Login Screen Tutorial

25
  • by
  • in Flash tutorials
  • — 28 Jan, 2010

In today’s Flash tutorial I would like to explain to you how you can protect your flash movie with a custom login feature . This is the case that you have sensitive information that only certain people are allowed to see.

Related posts:

  • Create Your First Android AIR App in Flash
  • How to Create a Snake Game in Flash Using AS3
  • Creating Reflection in Flash Using AS3
  • Bitmap Data Manipulation in Flash ActionScript 3
  • Creating and Controlling Flash Animation with XML
  • How to Build a XML Driven Quiz Application in Flash
  • Approach to Understand XML and Flash Workflow

To do this we will just be using conditional statements (if/else) in actionscript.

Note of caution, this is not really a secure way of protecting your file, as somebody could decompile your swf, and therefore gain access to your sensitive information(username/password). It is meant to serve as a real world example of using contiional statements in flash & AS 3.

Let’s assume that I have a secret page that I would to protect, and I only want to share this information with a few friends. In this case it is a page of  “Secret Flash Tips”

First create a new flash AS 3 document

make the width 600 px and the height 300px with a black background.

lets first create all our layers, I will place everything on its own layer:

  • actions
  • message
  • button
  • text
  • text input
  • header
  • background

You should have these layers

Using the rectangle tool create a recentangle covering the stage I am using  no stroke, and a color of#968E95

After you have a background that you like, covert to movie clip(right click, convert to movie clip) call it background. Place this background movieclip onto the center of the stage leaving a boarder, now you could also leave the stage color white and use a heavy stoke, but I am just doing it this way. You should do this in the background layer.

Next take the text tool and create and create a header for this login page, I am using Verdana 30 px white with a knockout drop showdow. The text simple says” Graphic Mania Flash Tips”. Again in the header layer.

Below the header take the rounded rectangle tool and create 2 text input areas.  I am using height 200, height 30, with a color of #EEEEEE, and triangle options of 7.8. Then place both text boxes and on top of each other, and  place a dynamic text field on top of each of them. I am using American Typewriter Font(included in the fla), and don’t forget to embed your fonts! For both of the dynamic text fields give them an instance name of userTxt (for username), and passTxt(for password).  Also for the password field to get the “******” in the password text field, make sure to set the behavior to “password”. This is in the text input layer

To the right or each text input in the text layer, place the text USERNAME(top text input), and PASSWORD for the lower text input. This is done in the text layer.

Above the text input we will place a dynamic text field (message layer), with an instance name of messageTxt. I put  the text “Enter your username and password to log in”

final we will make a button, take the rounded rectangle tool create a square(80X 25) place the text login in the center, convert to movieclip call it login_btn

now the first scene design is done, and you should have this:

Now for the next scene, create keyframes for the second frame of the movie. We will only have the header, below the header will be a text field with a message, and below this another text box(telling people to remember to logout when they are done) to the right of the text box is another movieclip of a button, but this one has the text logout instead of login, and has an instance name of logout_btn. I also made the text white just to be a little differrent.

You should have something like this when you are done:

Now the design is done, and in the first keyframe, right click, and open up actions panel. The code to get this working is actually very simple.

First we use the stop command, so the movie does not loop by default, then some button handling(which I have talked about in past tutorials)

The logic is if they enter the correct password, let them to the second page, otherwise, show an error message. See complete code for frame 1:

So after they are done in the secure area, we want a way for them to be able to log out, which is done by sending them back  to the login page. The logic here is when the button is clicked, send them back to the login page(frame 1).

You can check the final SWF result below:

SWF result

Now that is it for now, next time I will show you the same application, but instead of coding to another frame, it will  go to a webpage.

Until next time happy flashing!

Johnny-

Share

Tags: Action Script 3Flash CS4Flash LoginFlash Tutorials

—

  • Previous story 10 Logo Design Tips to Create Professional Logo Design
  • Next story Your Best Choice to Flash Flipping Book Solution

You may also like...

  • Premium AS3 Flash Preloaders for Your Sites 9 Aug, 2011
  • Express Your Opinion: Take the Flash Industry Survey 22 Sep, 2010
  • Creating Reflection in Flash Using AS3 23 Jun, 2011
  • Create Your First Android AIR App in Flash 25 Oct, 2011

25 Comments

  1. Hicham says:
    January 28, 2010 at 4:51 am

    Thank’s for the tut,
    But can I ask you to add another part so we can verify the login/pass stored in the data base using php or coldfusion or even both of them
    and also a sign up section to let the user register…

    Thanks John.

  2. uberVU - social comments says:
    January 28, 2010 at 1:50 pm

    Social comments and analytics for this post…

    This post was mentioned on Twitter by grafikservice: How To Create A Flash Login Screen Tutorial http://bit.ly/dwA1Rh…

  3. Flash??????? : SS labs | SS labs says:
    January 28, 2010 at 2:03 pm

    […] How To Create A Flash Login Screen Tutorial […]

  4. johnnyb says:
    January 28, 2010 at 3:48 pm

    Hi Hicham,
    great idea for a future tutorial. I could do this in ColdFusion, which requires flash remoting. Lucky I am well versed in flash remoting-

    the flash side does not change much(more actionscript code), and you would do the processing with ColdFusion. I don’t use php, so I would not be the one to write a tutorial one that.

    I think first I would need to introduce flash remoting, which is a great idea for a tutorial.
    Another tutorial idea could be to do this with XML instead of a database, not as fast or secure, but might make a good tutorial.

  5. links for 2010-01-28 | RGBitmap – Diseño, Desarrollo y Creatividad + TICs says:
    January 28, 2010 at 9:01 pm

    […] How To Create A Flash Login Screen Tutorial | Flash, Design, Vector, Photoshop, Adobe Tutorials | Gr… Cómo crear una página de login con Flash. (tags: informacion tutoriales flash) […]

  6. Tweets that mention How To Create A Flash Login Screen Tutorial | Flash, Design, Vector, Photoshop, Adobe Tutorials | GraphicMania.net -- Topsy.com says:
    January 29, 2010 at 12:26 am

    […] This post was mentioned on Twitter by HowDo.us, apex, Hawaii Flash , Zizi Vzin, munkkron77 and others. munkkron77 said: ??? flash ?????? login http://www.graphicmania.net/how-to-create-a-flash-login-screen-tutorial/ […]

  7. miklweb says:
    January 29, 2010 at 10:55 pm

    Hello Johnnyb,

    in first, thank you for the tuto.

    i am a french young webdesigner, and AS3 is not really simple for me. In your tutorial i want to replace the “goto (2)” by an url (http://xxxxxxxxx.com for example).
    Can you help me PLEASE !!!!

    Thank you for your answer…

    Miklweb

  8. johnnyb says:
    January 30, 2010 at 4:20 pm

    That example will be up in a few days, it is the second part to this one. The main difference is instead of going to a frame it will go to a webpage.

    Therefore after somebody enters the site with the correct usernmae/password instead of going to frame 2 it will go to some webpage. This is what you are wanting?

    By the way, you say “AS 3 is not really simple for me” Can I ask why? Did you find AS 2 simple, but AS 3 is complex? Or do you find actionscript in general not simple?
    .-= johnnyb´s last blog ..ColdFusion & XML =-.

  9. favSHARE says:
    February 1, 2010 at 3:24 am

    This article has been shared on favSHARE.net. Go and vote it!
    .-= favSHARE´s last blog ..Make Money Online With Domain Purchase =-.

  10. How To Create A Flash Login Screen Tutorial | favSHARE.net says:
    February 1, 2010 at 3:24 am

    […] Read the original article […]

  11. miklweb says:
    February 1, 2010 at 5:43 pm

    Hello Johnny,

    “Therefore after somebody enters the site with the correct usernmae/password instead of going to frame 2 it will go to some webpage. This is what you are wanting?”

    Yes, it’s exactly that i want.

    To answer at your question , i find Action script is not simple in general but the AS3 is less easy that As2.

    see you !!

  12. How to Create Login in Flash Tutorial | Flash, Design, Vector, Photoshop, Adobe Tutorials | GraphicMania.net says:
    March 7, 2010 at 3:54 pm

    […] The last tutorial I showed how to to create a simple flash based login just using actionscript. A visitor has asked “how do I modify this to go to a web page instead of a different scene?” So this is the topic of today’ s tutorial, and the solution is very simple! […]

  13. Glenn says:
    March 8, 2010 at 12:32 pm

    thank you so much for the source code. i was about to create how to make an AS3 actionscript to handle login system using Flash CS4

    Thx
    .-= Glenn´s last blog ..Travian Browser Game =-.

  14. johnnyb says:
    March 9, 2010 at 4:34 pm

    @ miklweb
    As promised I created the other tutorial to go to another webpage instead of a scene. I hope you like it, if you have any questions, please let me know.

    http://www.graphicmania.net/how-to-create-login-in-flash-tutorial/
    .-= johnnyb´s last blog ..Remoting Login & ColdFusion =-.

  15. johnnyb says:
    March 9, 2010 at 4:36 pm

    @Glenn Cool I am glad- One not I would not use this in production as it is not secure(nor is it meant to be), In production you should really use a database or XML to store the passwords, but this is fine for non sensitive information too-
    .-= johnnyb´s last blog ..Remoting Login & ColdFusion =-.

  16. Updated the Flash Tutorials « HFUG says:
    April 11, 2010 at 11:47 am

    […] How To Create A Flash Login Screen Tutorial […]

  17. Val says:
    July 7, 2010 at 9:29 am

    Beautiful! Great site!,Jul 7, 2010 11:29:14 AM

  18. Ryanpearl50 says:
    February 11, 2011 at 1:35 am

    i have macromedia flash 8, which is an earlyer versian, does this work in earlyer versians?

  19. rafiqelmansy says:
    February 12, 2011 at 4:51 pm

    I do not think it will work as you need AS2

  20. Yoga Das says:
    February 19, 2011 at 12:24 pm

    This script helped me to create a login page . Thank you

  21. Loai says:
    June 2, 2011 at 12:05 pm

    thank u so much for this awsome articl!!! can u please help? i want to add more that one user.! please help me please!

  22. Shane says:
    September 16, 2011 at 4:00 pm

    Great tutorial, but im relatively new to AS3. so What would the code be to change it to hitting enter instead of a button? Is it much different?

  23. TheDude says:
    October 12, 2011 at 6:40 am

    #Shane

    passTxt.addEventListener(KeyboardEvent.KEY_DOWN,handler);

    function handler(event:KeyboardEvent)
    {
    if(userTxt.text == “agent47” && passTxt.text == “alpha” && event.charCode == 13)
    {
    gotoAndStop(2);
    }
    }

    That’s how I got it working, but if I also add the alert variable at the buttom “else” , then it will just say access denied for every key I press. I wish knew hot to do it so the alert 1st pops up if the entrance is wrong AFTER I have pressed the enter.. :S Hope somebody can understand and can help

  24. Agent48353 says:
    August 1, 2012 at 7:05 pm

    Hello John
    When tested the flash it gave an error
    The class or interface ‘MouseEvent’ could not be loaded

  25. Beurm says:
    January 24, 2013 at 4:19 pm

    How can i link a login page to my access or excell database?
    To see my database after log in.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Promo Codes Available

    A2 Hosting Coupon
    NordVPN Coupon
    Unbounce Coupon
        • Home
        • Privacy Policy
        • About the Author
        • GRAPHIC MANIA – Guest Post Guidelines
        • Contact

        Copyright © 2008-2024 GraphicMania.net. All Rights Reserved.