-
Keyboard control
How can i make a combination of keys make a movie clip visible? Basically i want something like this to work:
if(Key.isDown(Key.Alt && Key.A)){
reminder._visible = true;
}
So when someone presses the Alt and A keys down at the same time the 'reminder' mc becomes visible?
Doesnt have to be these keys if thats an issue.
-
Hi! Most of the keys have a code, instead of the actual character.
"A" for example, is 65. More keycodes can be found here: http://www.video-animation.com/flash8_024.shtml
Code:
var keyListener:Object = new Object();
keyListener.onKeyDown = function(){
if(Key.isDown(Key.ALT) && Key.isDown(65)){
reminder._visible = true;
}
}
Key.addListener(keyListener);
This script only checks when a button is down, instead of using onEnterFrame, which constantly checks for it and uses more CPU.
NOTE: The ALT key won't work while testing in Flash.
Last edited by Vexy; 08-11-2009 at 08:49 PM.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|