This content has been marked as final. Show 5 replies
use an onChanged handler for your textfield to restore your textfield's text property.
so now you know what my original problem was in another thread.
I did make a work-around, which was a bit sneaky. I made a dummy text field and had the focus set to that during the time when the "1" or other digit keypresses were made. I made this field invisible to the user . Then I switched the focus back to the regular text field in the print handler. That worked.
But one more question - is there a way to redirect std out of the keyboard?
i think that would present security issues if flash could redirect keyboard output. so no, it cannot.
if you do this, how do you stop "desired" keypresses to that text field from constantly being re-written from the "onChanged" handler. seems as if it would go into an endless loop.
unfortunately on text input fields, the "changed" event does not work for this case. Somehow the keypress event that I am using to detect the digit keys is intercepting that.
But I found a much easier fix which is actually working!
Its the TextInput restrict method which restricts specific chars from being entered in that field from the keyboard.
display_txt.restrict = "^0-9 ^A-Z";
does the trick.