3 Replies Latest reply on Aug 3, 2012 1:11 PM by Flex harUI

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

    mrHanditan

      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