-
Button sensitivity
Is there a way I can make Flash realize that the spacebar button should only be hit once? I have a problem where the keyboard is too sensitive, and sometimes Flash is reading it as if I pressed it twice, thus excuting a second command. Is there a way around this?
Here's the situation:
A character is walking, it collides with another character, which gives the user a prompt to talk to the other character. Now, if the user hits spacebar, the dialog screen will appear. In this dialog screen, I want to have a default response already chosen, so that the user can just hit spacebar to choose that response. The problem is, if the keyboard is too sensitive, the first time the visitor hits spacebar, it goes straight to the second dialog screen because Flash took the second spacebar hit to indicate to move on. How can I solve this problem?
-
-
Hi,
You can use a 'timer' to calculate the time between the first hit and the second! If the time difference between both hits is to close, it's not registered as a second hit...
Look at this tutorial! It explains how you can manage that...
http://www.flashkit.com/tutorials/In...-666/index.php
WEBDESIGN is ART, or it is not WEBDESIGN
----------------------------------------
email: mail@thelegend.be
website: www.thelegend.be
-
Deathbringer
is the chat function initated onKeyUp or with an Key.isDown(32)?
-
is the chat function initated onKeyUp or with an Key.isDown(32)?
It's using Key.isDown(SPACE)
-
Deathbringer
then use onKeyUp. isDown is best suited for instant, repetitive actions... like a character walking, and works better than onKeyDown. onKeyUp, happens when the key is released, or once every down/up cycle so it will not be affected by the sensitivity.
that said, if you can't alter your code, just set a variable to say your character is chatting:
if (Key.isDown(SPACE) and !chatting) {
chatting = true;
beginChatting();
}
when they're finished:
chatting = false;
make sure you set chatting to false before. relying on undefined isn't safe if you come back to the frame cos it could be still set to true.
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
|