开发者

In Flex,how to catch input from card Reader without affecting from other key inputs?

开发者 https://www.devze.com 2022-12-26 10:02 出处:网络
Need to create a application which reads input from card reader. Input coming from card reader开发者_如何转开发 as strings which is similar to the keyboard event. In flex,I can catch this string by

Need to create a application which reads input from card reader.

Input coming from card reader开发者_如何转开发 as strings which is similar to the keyboard event. In flex,I can catch this string by listening key event.

Problem is that when someone presses key while swiping a card from card reader. Both will be appended in the input. How can i resolve this? Please suggest.

-Abhishek


Does the card reader use any kind of key code? An actual key press event has a charCode property so that you can programatically tell which key was pressed. figure out what charCode your reader is kicking back and then only append when the event matches that charCode.

Really you should just trace out the keyboard event and see what you can find unique about it, properties like keyLocation might help identify what's coming from the reader vs the keyboard.

If all else fails you can make it a requirement that the user do something that would pretty much prevent them from typing at the same time like holding the alt key down while they read a card. in which case you can check if altKey is true during the event.

0

精彩评论

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

关注公众号