Skip navigation
raphael the piper
Currently Being Moderated

Can I capture the keyboard events while my UI component is busy?

Apr 18, 2013 3:06 AM

My simple Flex application is doing the following,


  1. read user input from a barcode scanner. 
  2. fetch data from some web service and populate the UI controls
  3. user update/amend the data and click a button to save the changes


My problem is while the app is busy on saving the data,  the user try to scan another barcode.


Can I capture the barcode/keyboard input while my UI component is blocked and then re-send them to any non-focus component later?





  • Currently Being Moderated
    Apr 18, 2013 8:40 AM   in reply to raphael the piper

    Why don't you do a check on the function that processes the barcode reader to see if there is an request being processed.  Then you could just put up an alert for the user to wait until the previous request is finished.

    Mark as:
  • Currently Being Moderated
    Apr 19, 2013 7:55 AM   in reply to raphael the piper

    So, then the question is, did you try to add a keyboard listener to your application?

    You would still have to set some global parameter to determine whether or not to ignore the action in the keyHandler function.


    private function initApp():void {
                FlexGlobals.topLevelApplication.addEventListener(KeyboardEvent.KEY_UP, keyHandler);
            private function keyHandler(event:KeyboardEvent):void {
                if(barcodeInProcess) {
         // display alert
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points