Skip to main content
Participating Frequently
June 22, 2021
Question

Keydown event listener not working in Animate 2021

  • June 22, 2021
  • 1 reply
  • 1237 views

Hi all,

I have many programs that were working with keydown event listeners, but none of them work now in Adobe Animate 2021. Some are fully working games. Below is an example of the code used. This is a simple left key press to play a walk animation.

I tried to attach two different an Animate .fla file to this post but received an error message saying that the content type didn't match the file extension. Both open in Animate though.

 

import flash.events.KeyboardEvent;


stage.addEventListener(KeyboardEvent.KEY_DOWN, onkeydown);
function onkeydown(e:KeyboardEvent){
if(e.keyCode == 37){
ninjacat.gotoAndPlay("walk");
}
}

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    June 22, 2021

    are you clicking your stage to interact with it before using the kb keys?

    Participating Frequently
    June 22, 2021

    Yes I am. I have loaded the files into a an online Flash Emulator and have downloaded an old stand-alone Adobe Flash Player and the files work fine in both of these. My computer is a work one, managed by Education Qld, so I am going to get a student to test on their own device today (also Animate 2021) to eliminate this as the cause. I will update this post when done 🙂

    Donna

    kglad
    Community Expert
    Community Expert
    June 22, 2021

    it works for me in animate 2021