Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

HTML5 Canvas - Keyboard events not working properly

Community Beginner ,
Sep 22, 2018 Sep 22, 2018

I am creating an interactive product in Adobe Animate CC 2017 using the HTML5 Canvas.

I am trying to detect a keydown and keyup event on the arrow keys so that I can animate a character walking when the user presses the arrow key. I need to listen for keyup so that the character stops walking when they let go of the key.

I have the following code, but the keyup event refuses to fire consistently. It fires maybe on every 10 arrow keys pressed. Is this a bug in Adobe Animate CC? When I put the same code into a plain HTML file, it works perfectly.

        window.addEventListener("keydown", function(e){                console.log("Down: " + e.keyCode);         });          window.addEventListener("keyup", function(e){                console.log("Up: " + e.keyCode);         });
991
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 22, 2018 Sep 22, 2018

maybe you have a browser issue.  it works with chrome and the other major browsers.

Translate
Community Expert ,
Sep 22, 2018 Sep 22, 2018
LATEST

maybe you have a browser issue.  it works with chrome and the other major browsers.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines