AIR issues with entering Czech characters into text control
While I was working on Flex application that was integrated as desktop application using Adobe AIR, I face this very strange issue. While I was entering text into TextField, all previously entered text disappears after pressing Shift+4/č! It was really frustrating bug not only from user experience point of view
. So how to fix it if it is out of your control? Simplest way is to wait for a fix from Adobe, but I was not my case. I wrote a small workaround. It is not ideal, because all these workarounds are for certain cost. I created a small method for filtering wrong inputs and correct them. Yes, it is not so nice, but it saved my project timeline
.
public static function fixTextInput(event:KeyboardEvent) : void { if ((event.charCode == 13) && (event.keyCode == 52)) { event.preventDefault(); var control:TextInput = TextInput(event.currentTarget); if (event.shiftKey) { control.text = control.text.substring(0,control.selectionBeginIndex) + "4" + control.text.substring(control.selectionBeginIndex,control.text.length); } else { control.text = control.text.substring(0,control.selectionBeginIndex) + "č" + control.text.substring(control.selectionBeginIndex,control.text.length); } control.setSelection(control.selectionBeginIndex + 1, control.selectionBeginIndex + 1); } }
ActionScript AIR Flex workaround






