A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: evaluating nothing in a text field

  1. #1
    Member
    Join Date
    Oct 2002
    Location
    Tucson
    Posts
    97

    evaluating nothing in a text field

    I have a textfield on stage that I have set focus on named noentry1

    I want to write script that that will just go to frame #10 when the user presses the enter key.

    I don't want the user to type anything in the textfield. if they do I want them to go to frame 20 where I can tell them they shouldn't have typed anything in the test field.

    here's what I got so far.

    Any help would be greatly appreciated.

    code:
    on(keyPress "<Enter>"){
    if(noentry1.text != " ");
    gotoAndStop(10);
    }



    Thanks in advance

    -Lemorris

  2. #2
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Removing any helpful previous posts I mistakenly contributed to these forums.

    See ya FK'ers
    Last edited by NTD; 10-19-2006 at 09:12 AM.

  3. #3
    Senior Member
    Join Date
    Nov 2005
    Location
    dante's inferno
    Posts
    904
    this will check if the text has changed in the box
    code:

    my_txt.onChanged = function(){
    // do this
    };


    thing is, as soon as a character is typed in the field the function will fire. so basically, If I type "A", before I type anymore it will go to frame 20. If you would like them to type a couple of characters before going to frame 20, you can do this:
    code:

    my_txt.onChanged = function(){
    if( my_txt.text.length>=10) // 10 is the amount of characters you will allow before it goes to 20
    gotoAndStop(20);
    }
    };


    hope this helps

    IMS

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