byis
December 2, 2002, 5:32am
1
How would I enable the enter key to work with the function listed below as well as mouse release…
enter_btn.onRelease = function() {
output1 = //calculations go here//
};
Not use to using key responses in junction with functions…Thanks for the help!
system
December 2, 2002, 5:42am
2
Instead of using functions you can just do this…
onClipEvent (enterFrame) {
if (Key.isDown(Key.ENTER)) {
trace("Enter Button Pressed");
}
}
system
December 2, 2002, 9:28pm
4
No problem, I am glad I could help
system
December 4, 2002, 12:53pm
5
Lost, you can probably help me with this. Trying make so that when you hold down both the CTRL and Z keys clears input field.
Doesnt Work:
if (Key.isDown(Key.CONTROL & Key.Z)) {
input1 = spaces;
};
Also Doesnt work:
Doesnt Work:
if (Key.isDown(Key.CONTROL & Key."Z")) {
input1 = spaces;
};
This Works:
if (Key.isDown(Key.CONTROL & Key.SHIFT)) {
input1 = spaces;
};
Thanks…
system
December 4, 2002, 4:42pm
6
Try changing & to &&
&& is a boolean value saying if this statement and this statement are true then do this.
system
December 4, 2002, 4:59pm
7
Alright, I did this and it worked great
onClipEvent (enterFrame) {
if (Key.isDown(Key.CONTROL) && Key.isDown(90)) {
trace("CTRL+Z has been pressed");
}
}
90 is the code used for the letter “z” (lowercase). You need 2 Key.isDown statements because if you use && inside the first isDown then it still works if just z is pressed… I don’t think you want that
If you ever need to find out what letter is what code or whatnot, I wrote up with this script that I refer back to all the time when I need to find out.
Just put this in Frame 1 and you are done…
keyListener = new Object();
keyListener.onKeyDown = function() {
keypressed = Key.getCode();
trace(keypressed);
};
Key.addListener(keyListener);
(works only in MX)
system
December 5, 2002, 2:17am
8
Thanks Lost that worked great. That script will be nice to have…
system
December 6, 2002, 1:51am
9
Yeah, the getCode script definitely comes in handy when you just can’t put your finger on the code of the character you want
I am glad everything works for you