Tuesday, January 30, 2007

Detecting keycombo in actionscript:


var keyListener:Object = new Object();
keyListener.onKeyDown = function()
{
// Ctrl+d (Keycombo only works when testing in browser)
if (Key.isDown(Key.CONTROL) && Key.isDown(68))
{
trace("control+d pressed");
}
}
Key.addListener(keyListener);



NOTE: Be sure to turn off the keyboard shortcut by going to Control->Disable Keyboard Shortcuts when you are testing the movie.