KeyboardState.pressed is always true after .prompt or alert - Why?

Posted by Yenza on Stack Overflow See other posts from Stack Overflow or by Yenza
Published on 2014-05-28T12:30:45Z Indexed on 2014/08/23 22:21 UTC
Read the original article Hit count: 202

Filed under:
|
|
|

As the title says, I have tried THREEx and Stemkovskis standalone KeyboardState.js , and neither of them seems to update properly.

This is my code:

m_vKeyboard = new THREEx.KeyboardState();
// m_vKeyboard.update(); // if using stemkovskis
if (m_vKeyboard.pressed("F")) {
    alert("And now it is always true!");
}

you click the F key once, release it; alert window pops up, click OK, it pops up again for all eternity. How come?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about keyboard