In Flex,how to catch input from card Reader without affecting from other key inputs?
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.
精彩评论