A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: If var contains the string "222"

  1. #1
    Senior Member
    Join Date
    Aug 2003
    Posts
    438

    If var contains the string "222"

    How can I check if a textbox has a specific string?
    For example, if textbox contains "@", then make var "Email_valid" = true.

    I can't explain it very well..

    In VB, the code would be:

    if instr(text2.text, "22222")

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Make a textbox and give it a var name. Here is a little script:

    mytext="2222";
    if(mytext=="2222"){
    trace("true");
    }else{
    trace("false");
    }

    will give true.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Senior Member
    Join Date
    Feb 2004
    Posts
    312
    or u can use my_str.indexOf(substring, [startIndex]) or my_str.lastIndexOf(substring, [startIndex])
    see flash help for more info on how to use it
    and checl out String class might find something useful

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