开发者

problems with KeyboardEvent and special characters requiring shift key

开发者 https://www.devze.com 2023-01-13 07:50 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消