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

Keydown event listener not working in Animate 2021

Community Beginner ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

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");
}
}

Views

756

Translate

Translate

Report

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
Community Expert ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
Community Beginner ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
Community Expert ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

it works for me in animate 2021

Votes

Translate

Translate

Report

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
Community Beginner ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

Solved - for some reason, the Show Redraw Regions in the settings wasn’t ticked. My laptop has been re-imaged three times in the last couple of months due to a number of problems so Animate has been re-installed each time. This should be a default setting, so have no idea why it wasn’t ticked? I’ve never been into the swf settings before either. Weird!

settings.png

Votes

Translate

Translate

Report

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
Community Expert ,
Jun 23, 2021 Jun 23, 2021

Copy link to clipboard

Copied

LATEST

i don't think that's relevant, but i'm glad you no longer have a problem.

Votes

Translate

Translate

Report

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