Technology blog oriented towards good design and impressive web applications.

IdleTogether Home

Capture CTRL+N / CMD+N in Flex/Air/AS3

by Nicolas Noben

When you program features for (web) application, it’s often useful & good practice to allow users shortcuts for common actions.

This easy snippets shows how to capture ‘new’ or Control+N or Command+N on the Mac.

stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);

private function keyDown(e:KeyboardEvent) :void
{
        if(e.commandKey || e.ctrlKey)
        {
                switch(e.keyCode)
                {
                        case Keyboard.N:
                                // do stuff
                        break;
                }
        }

}


Related Posts




Leave a Comment







  Please note: Comments are reviewed before going public.