now works, thanks a lot! On Dec 17, 2007 7:38 AM, simonjpalmer <[EMAIL PROTECTED]> wrote:
> one thing to check is whether your app has focus in the browser window > - some browsers do not give the player focus by default. If you click > somewhere on your app running in the browser then press a key do you > get a message? > > Another route would be to add a control to your app which definitely > accepts focus (like a button) and move the event handling code in > there - just to test how to get your app responding to keyboard events. > > This code does work for me, but my app's front page is somewhat more > complex than the app you describe below. > > > --- In [email protected] <flexcoders%40yahoogroups.com>, > "Alejandro Narancio" > <[EMAIL PROTECTED]> wrote: > > > > Hi I already try that but is not working for me, using your example > I also > > tested this (first calling init() from the initialize and after from the > > applicationComplete): > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute" > > initialize="init()"> > > <mx:Script> > > <![CDATA[ > > import mx.controls.Alert; > > import mx.managers.PopUpManager; > > > > private function init(): void { > > addEventListener(KeyboardEvent.KEY_DOWN, watchKey); > > } > > > > private function watchKey(e: KeyboardEvent): void { > > Alert.show("TEST", "TEST"); > > } > > > > ]]> > > </mx:Script> > > <mx:Panel width="100%" height="100%" /> > > </mx:Application> > > > > > > This is not working for me when I press a key I am not receiving any > popup > > window. > > > > Thanks, > > Alejandro > > > > > > On Dec 16, 2007 5:41 PM, simonjpalmer <[EMAIL PROTECTED]> wrote: > > > > > add an event handler to your app to trap a key down event and then > > > check for the combinations you support as shortcuts and perform the > > > your functions accordingly. > > > > > > here's a fragment from my own code which traps ctrl+shift+D and shows > > > some debug messages... > > > > > > in my app's initialisation routine... > > > > > > addEventListener(KeyboardEvent.KEY_DOWN, watchKey); > > > > > > private function watchKey(e:KeyboardEvent):void > > > { > > > if (e.ctrlKey && e.shiftKey) > > > { > > > if(e.keyCode == 68) > > > { > > > toggleDebug(); > > > } > > > } > > > } > > > > > > this is all in the docs... > > > Simon > > > --- In [email protected] > > > <flexcoders%40yahoogroups.com><flexcoders%40yahoogroups.com>, > > > "Alejandro Narancio" > > > > > > <ale.narancio@> wrote: > > > > > > > > Hi all! > > > > > > > > I am trying to add a shortcut to my application (for example when > > > the user > > > > press Ctrl+P open a print dialog), it is possible to catch this? I > > > mean to > > > > make custom shortcuts for my application? > > > > > > > > I will appreciate any suggestion or guideline. > > > > > > > > thanks! > > > > Alejandro > > > > > > > > > > > > > > > > > >

