PDA

View Full Version : How do you disable enter??


Thylacine
04-01-2003, 09:11 PM
In my little game people need to press a button to go on, but it's people's nature to press the enter button. When they do this it plays through all my pages.

I've tried this (to test my code out):

if (Key.isDown(Key.ENTER)) {
trace("Hello");
}

And it doesn't work. If I replace ENTER with UP, and press the up key, it will work, but nothing will make ENTER work!

What should I be typing?

Thank you very much,
Jen

Jesse
04-01-2003, 10:13 PM
Try using:
fscommand("trapallkeys", true);
In conjunction with your other code.

Thylacine
04-01-2003, 10:52 PM
To move my character around, you use the arrow keys. If I put that, wouldn't it disable them too?

Jesse
04-01-2003, 11:01 PM
Nope. I can still use the other keys:
fscommand("trapallkeys", true);
myKL = new Object();
myKL.onKeyDown = function() {
if (Key.isDown(Key.LEFT)) {
trace("Hello");
}
};
Key.addListener(myKL);
However I just read your question properly and now I'm confused. Are you saying that with the browser when people hit Enter your movie loops? I can't replicate that problem... In the test environment it will happen, but not in the browser.