Conceptually this sounds good.  However, I would expect this method 
would be non-intuitive to users.

  Containers will not broadcast keyboard events on their own, so the 
user must have have given focus to a component that will broadcast the 
keyboard events.  I believe there are a lot of situations, such as 
changing the selectedIndex of a ViewStack or tabbing through a 
TabNavigator where nothing will be given focus and the bar code scan 
would be ignored.



Josh VanderBerg wrote:
> 
> 
> 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 
> <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 
> <http://vanderblog.typepad.com>
> 
> --- In [email protected] <mailto:flexcoders%40yahoogroups.com>, 
> "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!
>  >
> 
> 

-- 
Jeffry Houser, Technical Entrepreneur, Software Developer, Author, 
Recording Engineer
AIM: Reboog711  | Phone: 1-203-379-0773
--
My Company: <http://www.dot-com-it.com>
My Podcast: <http://www.theflexshow.com>
My Blog: <http://www.jeffryhouser.com>

Reply via email to