I agree, its likely something to do with the browser not giving the plug-in focus. However why does it work with the apple and shift keys, and only those keys?
--- In flexcoders@yahoogroups.com, "Alex Harui" <[EMAIL PROTECTED]> wrote: > > You're probably hitting the classic, browser won't activate plug-in > issue. When Flash apps start up in FireFox, they can't be given focus. > > > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of aconfrey > Sent: Friday, December 14, 2007 6:04 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Re: Problem with Keyboard events in Firefox (OSX) > > > > > Thanks Shaun. I tried adding the listener to the stage (need to change > the startUp function to be triggered from an addedToStage event so > that the stage was set but otherwise the code is the same). However I > see exactly the same behavior. > > Any other ideas? > > Thanks, > > Tony > > --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > , shaun <shaun@> wrote: > > > > Hi, > > > > I think you need to attach the listeners to the stage. > > > > HTH > > > > aconfrey wrote: > > > I'm going crazy with a bug/feature trying to receive keyboard > events. > > > I've created a very basic app to demonstrate. I have a VBox with a > > > Canvas containing a TextArea. I want the TextArea to be invisible > > > unless a certain key is pressed. With the code as listed below on > > > Firefox I only receive KEY_DOWN events for the 'apple' key and the > > > shift key! If I click in the application area then everything works > > > fine and all events are received, but I don't want my user to have > to > > > click. On Safari and the standalone Flex player all keyboard events > > > are received without clicking. > > > > > > I've played around with all combinations of which container to > > > register for key press events on and which container to set focus > to. > > > Apart from making the behavior even more bizarre nothing seems to > work. > > > > > > What am I missing? > > > > > > Thanks > > > > > > Tony > > > ---------- > > > KeyPressTest.mxml > > > ---------- > > > <?xml version="1.0" encoding="utf-8"?> > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml > <http://www.adobe.com/2006/mxml> " > > > layout="absolute" width="100%" height="100%"> > > > <mx:Script><![CDATA[ > > > public var theClass:Typer; > > > public function startUp(c:Canvas, txt:TextArea):void { > > > theClass = new Typer(c, txt); > > > } > > > ]]></mx:Script> > > > <mx:VBox horizontalCenter="14" verticalCenter="18" height="100%" > > > width="100%" horizontalAlign="center" verticalAlign="middle"> > > > <mx:Canvas id="cnvs" height="100%" width="100%" borderStyle="solid" > > > creationComplete="startUp(this.cnvs, this.txt)"> > > > <mx:TextArea width="100%" height="100" verticalScrollPolicy="auto" > > > id="txt" visible="false" text="Can you see Me?"/> > > > </mx:Canvas> > > > </mx:VBox> > > > </mx:Application> > > > ------------ > > > Typer.as > > > ------------ > > > package > > > { > > > import mx.containers.*; > > > import mx.controls.*; > > > import flash.events.KeyboardEvent; > > > > > > public class Typer > > > { > > > private var ta:TextArea; > > > private var cv:Canvas; > > > public function Typer(c:Canvas, txtArea:TextArea) { > > > ta=txtArea; > > > cv=c; > > > cv.addEventListener(KeyboardEvent.KEY_DOWN,typing); > > > cv.setFocus(); > > > } > > > > > > public function typing(e:KeyboardEvent):void{ > > > trace("now we're typing - keydown", e); > > > ta.visible=!ta.visible; > > > cv.setFocus(); > > > } > > > } > > > } > > > > > > > > >