whatisittellme
asked on
Esc key - Keyboard event in Actionscript 3
I am trying to associate an action to Escape-key event in AS3 using the following code.
The problem is that the event is triggered (rather 'pressed escape' is printed) only when I press Shift+Escape and not just Escape.
I want it to work with just Escape key.
I would greatly appreciate if anyone can point me to the mistake I am making. Thanks.
The problem is that the event is triggered (rather 'pressed escape' is printed) only when I press Shift+Escape and not just Escape.
I want it to work with just Escape key.
I would greatly appreciate if anyone can point me to the mistake I am making. Thanks.
stage.addEventListener(KeyboardEvent.KEY_DOWN, KeyPressed);
function KeyPressed(evnt:KeyboardEvent){
switch (evnt.keyCode) {
case Keyboard.ESCAPE :
trace("pressed escape")
break;
case Keyboard.RIGHT :
trace("RIGHT");
break;
case Keyboard.LEFT :
trace("LEFT");
break;
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi!!
Are you talking about the Control menu?? I am not finding the option "Disable keyboard shortcuts" there.
Where to find this option. Please clarify.
Thanks in advance.
Are you talking about the Control menu?? I am not finding the option "Disable keyboard shortcuts" there.
Where to find this option. Please clarify.
Thanks in advance.
It's in the control menu of the Flash player playing your SWF, not Flash's Control menu.
So in flash, run your movie (ctrl + enter) and THEN look for 'Disable Keyboard shortcuts' in the Control menu.
So in flash, run your movie (ctrl + enter) and THEN look for 'Disable Keyboard shortcuts' in the Control menu.
oh!! cool!!
got it now..
thanks dauntless
got it now..
thanks dauntless
ASKER