Skip navigation
Currently Being Moderated

TLF 3.0: How to restrict TextFlow to only accept Numbers?

Aug 2, 2012 4:29 PM

Hi all,

 

I was reading a post in this forum that overriding the EditManager will allow me to intercept the keyboard input.

So I did that and below is code that I put to override the keyboardDownHandler:

 

override public function keyDownHandler(event:KeyboardEvent):void

{

                              if (NUMBERS_ONLY_MODE)

  {

                                           if (event.charCode < 48 || event.charCode > 57)

    {

        event.stopImmediatePropagation();

                                                                 return;

    }

  }

                              super.keyDownHandler(event);

}

 

Even though it goes to event.stopImmediatePropagation when I was typing any character other than numbers, textFlow still shows what I typed in.

 

Any ideas of why this is not working?

Appreciate the help.

 

Handi

 
Replies
  • Currently Being Moderated
    Aug 2, 2012 10:30 PM   in reply to mrHanditan

    Look at how Spark TextInput handles the restrict property.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 3, 2012 1:11 PM   in reply to mrHanditan

    I don’t know TLF to that level of detail.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points