dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: text variable

Hybrid View

  1. #1
    muvipix.com
    Join Date
    May 2001
    Location
    Maine
    Posts
    289

    text variable

    I may be in wrong part of the forum, but maybe someone can help here. I'm trying to match exact text for a password field. One field is pulled up by xml and the other is plain ol' input. I have a statement
    Code:
    if (mytext.text == myothertext.text) do something
    What I would like it to do is, if the text matches exactly, to proceed to the "do something". I'm real close I think, but no matter what I put in the input field, it fires the do something. I guess my question is: how to make it look for exact text? ANd this text can change - the reason for the code not including "some text". If I'm not clear, please yell at me!! Thanks.
    Regards,

    Ron

  2. #2
    shorter than most, but not all findShorty's Avatar
    Join Date
    Apr 2002
    Location
    brisbane
    Posts
    239
    this is fine if you're matching two textfields, both of which have been given instance names and are therefore treated as movieclip instances.
    HOWEVER, if you're matching an input textfield, to a variable called in via xml, you'll don't need the ".text" identifier on one side of the comparison.
    code:

    if (myInputTextfield.text==password) {
    // do something
    } else {
    // kick user in the spuds
    }


  3. #3
    muvipix.com
    Join Date
    May 2001
    Location
    Maine
    Posts
    289
    That's just it, and I'm sorry if I didn't explain well in my post. The xml call can change (password changing ability). The password is not always going to be the same. The user can change this to anything they want, updates the xml, then I want to just do a "match" with the other input text field, ie,

    User changes their password to "rumble", updates the xml (invisible field, by the way). When the user enters "rumble" in the other text field, it's compared to the xml call and if it matches (exact text), "do something" - if not, "kick user in the spuds".

    I just thought this would be an OK solution to be able to change a password. There are many posts on password solutions (not real secure, I understand), but I couldn't find anything to have the ability to change the password. This will work if I can do a match of exact text, not just a field having some text. Or if there are better solutions, I'd be happy to hear them. Thanks much!
    Regards,

    Ron

  4. #4
    shorter than most, but not all findShorty's Avatar
    Join Date
    Apr 2002
    Location
    brisbane
    Posts
    239
    maybe try switching the order you're doing things.

    its not really necessary to update the xml after the first textfield has been altered is it?

    why not let them enter their new password, then confirm their new password in the 'confirmPassword' input field, check them against each other and then write the new password to the xml?

  5. #5
    muvipix.com
    Join Date
    May 2001
    Location
    Maine
    Posts
    289
    Originally posted by findShorty
    if you're matching an input textfield, to a variable called in via xml, you'll don't need the ".text" identifier on one side of the comparison.
    Actually, THIS was exactly what I was looking for. Thanks for pushing me in the right direction. Works perfectly now, after taking one of the ".text" identifiers off.

    Thanks findShorty!
    Regards,

    Ron

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