it seems Flex trapKeys(e:KeyboardEvent) has problems when user is pressing some special marks ; / ? = + ( ) & * with non-us (european) keyboards. Pressing these require shift key.
I am using String.fromCharCode
Any ideas why e.g. pressing semicolor combination faulty outputs "<"
var key:String=String.fromCharCode(e.charCode);
here is a workaround that I am using for semicolon now
if ((e.charCode == 60) && (e.keyCode==188)) {key =';';}
if ((e.charCode == 43) && (e.keyCode==187)) {key ='?';}
There is also same problem with this FLAS开发者_JS百科H event
onKeyDownEvent(keyboardEvent:KeyboardEvent)
You should not manually compose chars from event.charCode
or event.keyCode
. The only correct method of making user input a string is placing focus in input field and getting result from it's text
property.
You can make that input string invisible and show that input as you like. But you should not compose input chars like you do.
精彩评论