A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: How do I make a password box?

  1. #1

    How do I make a password box?

    I'm working on a puzzle like game where you need a password to get to the next level, but I am not sure how to make a password box. Can anyone tell me? Really apprecieate it, thanls guys.

  2. #2
    Senior Member MagnusVS's Avatar
    Join Date
    May 2005
    Location
    Oslo, Norway
    Posts
    764
    Make an input text field, and change it from "single line" to "password"? Or did I misunderstand you?

  3. #3
    Thanks a lot! But how do I make it go to the next frame when the password is typed in?

  4. #4
    Senior Member
    Join Date
    Oct 2004
    Posts
    2,049
    create a button and do something like this

    on(release){
    if(mypasswordbox.text == "mypassword"){
    _root.nextFrame(); //code if password equals
    }else{
    // add code if they dont equal;
    }
    }

  5. #5
    Ok, I created a imput password text section, and turned it into a button, but it didn't work,.

    I need more help, please and thanks!
    Last edited by clarence144; 11-02-2005 at 01:31 PM.

  6. #6
    Senior Member MagnusVS's Avatar
    Join Date
    May 2005
    Location
    Oslo, Norway
    Posts
    764
    Don't make the text like a button.

    In the "var" field of the dynamic text, write "password".

    Then you make a button (like "enter" or something), to which you attach this code:

    on(release, keyPress "<Enter>"){
    if(password=="abc"){
    gotoAndStop(2)
    }
    }
    (In this case, if you write the password which is "abc", it takes you to frame to when you click the button or press enter.

    You can also use this code:

    on(keyPress "<Enter>"){
    if(password=="abc"){
    gotoAndStop(2)
    }
    }
    with just the keypress and make the button small and invisible.

    Hope it'll help you!

    Magnus

  7. #7
    Thanks a lot man, I got it now! You're the best!!!

  8. #8
    Member
    Join Date
    Jul 2010
    Posts
    61
    I test this code , but it doesn't work . I use this code :
    on(release, keyPress "<Enter>"){
    if(password=="abc"){
    gotoAndStop(2)
    }
    }

    I observe notes , but it doesn't work ... .
    I make a dynamic text and in the "var" field wrote "password" . Then I make a button and attach that code on it . I export my file in "swf" and open it . but when I type "abc" my flash doesn't go to frame 2 .
    Please help me ! Thanks a lot .

    My "fla" file : http://qommc.persiangig.com/password.fla
    My "swf" file : http://qommc.persiangig.com/password.swf

  9. #9
    Senior Member
    Join Date
    May 2010
    Posts
    178
    It should be an Input Text Field instead of Dynamic Text Field.

    Poltuda

    Note: I'm using CS3.
    Last edited by poltuda; 07-26-2010 at 03:24 PM.

  10. #10
    Member
    Join Date
    Jul 2010
    Posts
    61
    Quote Originally Posted by poltuda View Post
    It should be an Input Text Field instead of Dynamic Text Field.

    Poltuda

    Note: I'm using CS3.
    Input text : Also doesn't work .
    Have you different code or idea ?

  11. #11
    Member
    Join Date
    Jul 2010
    Posts
    61
    Please answer

  12. #12
    Member
    Join Date
    Jul 2010
    Posts
    61

    Plase answer , any body !

    Quote Originally Posted by farzadbayan View Post
    Please answer
    Any body know my solution , please answer . I haven't much time .

  13. #13
    Senior Member
    Join Date
    May 2010
    Posts
    178
    need your FLA to checkout what you are doing

  14. #14
    Member
    Join Date
    Jul 2010
    Posts
    61
    Quote Originally Posted by poltuda View Post
    need your FLA to checkout what you are doing
    I put them later , but also :
    My "fla" file : http://qommc.persiangig.com/password.fla
    My "swf" file : http://qommc.persiangig.com/password.swf

    Thanks for your future help

  15. #15
    Junior Member
    Join Date
    Sep 2007
    Posts
    23
    Here you go
    http://spamtheweb.com/ul/uploads/316...1_password.fla

    Error #1:
    Your password text field was 'dynamic text', I changed it to 'input text'.
    I don't think people can input text into a dynamic text field.
    Here's what each field is used for:
    Static Text: Any text which will never be changed such as text telling a user what to do.
    Dynamic Text: Text which can be changed by the use of actionscript. Such as a score or the addition of 2 numbers or a counter.
    Input Text: A text field which a user can input text into. Such as a user/pass field.

    Error #2:
    You forgot to give your text field and instance name, so I named it 'pass'.
    I also changed your password variable which was used for the text field in your button actionscript to 'pass', just to avoid any conflicts there may be with the flash 'password'. (I tend to change any variable which may appear blue which means its used by flash)

    Error #3:
    I'm not sure if this is an error but I moved your keyPress "<Enter>" into a seperate statement, I've personally never used that but it probably works, just never tested it.

    Error #4:
    You forgot to add the _root. part when making the if statement for your password field. This basically locates the text field as being on the stage level.
    Here is an explanation of _root. this. and _parent.
    http://www.kirupa.com/developer/acti...arent_this.htm

    Error #5:
    You also forgot .text after the password part..
    It's a text field and you want to know what the text says, so you have to specify that.
    So it now looks like:
    _root.pass.text
    If you wanted to move the position of the text field, you could use
    _root.pass._x = 50;
    (Not _root.pass.text._x)

    Error #6:
    You forgot the semicolon (; ) after the gotoAndStop(2)
    Not sure if it's required all the time, seen people not using it but I prefer to.
    Last edited by lp9sc; 07-31-2010 at 05:07 AM.

  16. #16
    Member
    Join Date
    Jul 2010
    Posts
    61

    resolved

    Thanks a lot , thanks !
    They were done and your FLA file can work .
    Your guides were useful for me and my work .
    Thank you , Farzad

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center