A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Password Coding Help

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    2

    Password Coding Help

    I'm trying to create a password input area where a player can insert several passwords and be correct, each password triggering the typing of that password in a separate area (which is what the numbers one to ten in the script below refer to). However, there is some flaw I can't find in the script and if I try to enter anything in the box, it is changed to "orangemarmalade" (see below) and only enters there (acting as if I typed "orangemarmalade" every time). Any one have any help?



    on (release)
    {
    if (enterpassword = "orangemarmalade")
    {
    one = "orangemarmalade";
    }

    else if (enterpassword = "goldenafternoon")
    {
    two = "goldenafternoon";
    }

    else if (enterpassword = "andtheking")
    {
    three = "andtheking";
    }

    else if (enterpassword = "breadandbutterflies")
    {
    four = "breadandbutterflies"
    }

    else if (enterpassword = "rockinghorsefly")
    {
    five = "rockinghorsefly"
    }

    else if (enterpassword = "lobsterquadrille")
    {
    six = "lobsterquadrille"
    }

    else if (enterpassword = "momeraths")
    {
    seven = "momeraths"
    }

    else if (enterpassword = "maryjanes")
    {
    eight = "maryjanes"
    }

    else if (enterpassword = "mockturtle")
    {
    nine = "mockturtle"
    }
    else if (enterpassword = "marchhare")
    {
    ten = "marchhare"
    }

    else
    {
    enterpassword = "Try Again"
    }
    }

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    use double equal signs for comparison:

    if(enterpassword == "marchhare")

    a single = assigns.

    gparis

  3. #3
    Junior Member
    Join Date
    Mar 2010
    Posts
    2
    Quote Originally Posted by gparis View Post
    use double equal signs for comparison:

    if(enterpassword == "marchhare")

    a single = assigns.

    gparis
    hmm, tried it, didn't help. Thanks for trying though :/

  4. #4
    Senior Member
    Join Date
    Jan 2010
    Location
    England
    Posts
    268
    this should work, i think...

    Code:
    instancename.onRelease = function () {
    if (passwordinputfield.indexOf("chosenword") or ("chosenword2") or ("chosenword3") != -1) {
    		//whateveryouwant here
    }
    }
    paste into maintimeline just for the sake of keeping it all neat and tidy.
    might be addicted to flash...
    _______________________________________

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