Define a keyDown event handler at the application level.  Because of
the Flex 2.0 event model, all keydown events, from all controls,
should bubble up to the Application.  Here is a little application I
made to test this.  The bottom text area will show all keys typed, no
matter the control that has the focus when the key was pressed.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application keyDown="keyCapture(event)"
xmlns:mx="http://www.adobe.com/2006/mxml"; layout="vertical">
        
        <mx:Script>
                <![CDATA[
                        private function keyCapture(event: KeyboardEvent) : 
void {
                                allKeys.text += 
String.fromCharCode(event.charCode);
                        }
                ]]>
        </mx:Script>
        
        <mx:Label text="Text1" />
        <mx:TextArea id="textArea" height="200" width="200" />
        <mx:Label text="Text2" />
        <mx:TextInput id="textInput" />
        <mx:Label text="Button:" />
        <mx:Button label="Set Focus here" />
        
        <mx:Label text="Key Capture" />
        <mx:TextArea selectable="false" id="allKeys" width="400" height="400" />

</mx:Application>

__
Josh Vanderberg -- http://vanderblog.typepad.com

--- In [email protected], "Chad Gray" <[EMAIL PROTECTED]> wrote:
>
> Hello,
> 
> I am just doing research and need some input.
> 
> We would like to make an Air/Flex app that when you scan in a
barcode you get product details from a database that CF is serving out.
> 
> The barcode scanner works like a key board and at the end of a scan
I can have it send a carriage return.  I don't want the user to have
to put focus on a text input field then scan the barcode to get a
result.  I want them so that any keyboard entry from the scanner will
always pull up product details upon the carriage return.
> 
> It does not matter what section of the Appliction they are in.  If
text entry is present from the barcode scanner then I want to return
product details from the database.
> 
> Has anyone built an app that works with a barcode reader in this way?
> 
> Any quick code suggestions on capturing the text input from the
barcode reader?
> 
> Thanks!
>


Reply via email to