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>,
> "Alejandro Narancio"
>
> <[EMAIL PROTECTED]> 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
> >
>
>  
>

Reply via email to