Skip to main content
Known Participant
May 27, 2016
Answered

Why is my game only working when I hit enter and not when I click my start button?

  • May 27, 2016
  • 1 reply
  • 520 views

So I'm having a weird issue with a game I'm putting together with actionscript 3. 

The game is nothing complicated.  I found a tutorial online to get some simple navigation with the keyboard arrow keys.  I have a menu screen at the start of the game and I made a start button that takes you to another frame on the timeline where the game play is coded.  If I click that start button it navigates to the play section of the timeline but the keyboard controls don't work at all.  If instead of pressing the start button I just hit enter on the keyboard the swf plays forward until it hits the game section and the stop command and then the keyboard controls work fine.

Obviously my keyboard navigation controls are correct or it wouldn't be working at all but why does clicking the start button I created somehow stop it from working properly?

Any suggestions or thoughts anyone?

This topic has been closed for replies.
Correct answer Ned Murphy

See if the following discussion helps solve the issue:

http://stackoverflow.com/questions/12469276/action-script-3-keyboard-event-set-focus

1 reply

Known Participant
May 27, 2016

UPDATE!!

I've since discovered that if I click my start button the keyboard navigation will work as long as I click on the view screen once first.  This almost raises more questions though?  I tried it on another computer too and it's the same issue.  Also tried embedding it in an html in case it was just a flash specific glitch.  This makes no sense as far as I can tell.

I'm using Animate CC 2015 btw.

Ned Murphy
Ned MurphyCorrect answer
Legend
May 27, 2016
Known Participant
May 27, 2016

It did!  Thanks.

Follow up question though.  Is it possible to make it so the enter key won't advance forward on the timeline?  Like I want the arrow keys to work for my navigation in the game but I don't want to be able to leave the main menu screen unless I click a button with mouse.  I never actually realized this was an option with an exported swf until stumbling on it with this project.