A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Max/MinChars

  1. #1
    Member
    Join Date
    Apr 2011
    Posts
    42

    Max/MinChars

    Hey all,

    I've noticed that AS3 doesn't seem to contain a way of defining a minimum amount of characters required but does have a maximum.

    Any way to do this with a textfield?

  2. #2
    Senior Member
    Join Date
    Jul 2008
    Posts
    391
    You're talking about minimum characters in a textfield right? Well you can easily check the length of the text when you actually need to use the text with
    PHP Code:
    var len:int yourTextField.text.length
    If you want a textfield to always have a minimum number of characters inside it, that's a bit of an odd thing to want. There is an event that is triggered whenever a user presses a key inside a textfield but it triggers before the textfield is altered by the user's key. I think it's TextEvent.TEXT_INPUT. With that you can check if the textfield will still have the minimum length after it's altered. But again I don't see any reason to want this.

  3. #3
    Member
    Join Date
    Apr 2011
    Posts
    42
    Hey I'm sure this would work but how could I use it to check when the player pushes the submit button to send their name by a dispatched event that their's something written in the text field entered.

    EDIT: Used it in a if statement and finally got there, thank you.
    Last edited by AntBirch; 04-09-2012 at 06:41 AM.

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