Detecting if ctrl is pressed when clicking a button?
Hi
What's the best way to detect if ctrl is being held down while a button on screen is being clicked?
Cheers
Hi
What's the best way to detect if ctrl is being held down while a button on screen is being clicked?
Cheers
MouseEvent has several handy properties to tell you if a modifier key is currently held down:
function clickHandler(e:MouseEvent){
trace(e.ctrlKey); // Also works with Command on Mac
trace(e.controlKey); // Windows and Mac "control" key has different meaning
trace(e.commandKey); // Mac only
trace(e.shiftKey);
trace(e.altKey);
}
More here:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/MouseEvent.html
Cheers.
-Aaron
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.