Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capture key combination

Status
Not open for further replies.

lindaT

Programmer
Nov 12, 2003
1
US
Using Flash MX, I am trying to capture a Control + F for a system simulation. I have the book "ActionScript for Flash MX" and it gives some ActionScript code for this, but I cannot get it to work. Here is the code:
Code:
keyListener = new Object();
keyListener.onKeyDown = function () {
	if(Key.isDown(Key.CONTROL) && Key.isDown(70)){
		gotoAndStop("result");
	}
}
key.addListener(keyListener);
If I take one or the other Key.isDown component out, it works, but not when both are included.
Suggestions?
 
this will work, just attach it to a movie clip:
Code:
onClipEvent (enterFrame) {
  if (Key.isDown(Key.CONTROL) && Key.isDown(70)) {
    gotoAndStop("result");
  }
}
im no key expert, but I noticed some strange things about the code you posted:
1) it works if you do a SHIFT+CTRL+F or an ALT+CTRL+F
2) it also works if you tap CTRL and F exactly simultaneously.

draw your own conclusions... i cant explain exactly why your code doesnt work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top