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

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

Explorer ,
May 27, 2016 May 27, 2016

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?

TOPICS
ActionScript
471
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

LEGEND , May 27, 2016 May 27, 2016

See if the following discussion helps solve the issue:

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

Translate
Explorer ,
May 27, 2016 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.

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
LEGEND ,
May 27, 2016 May 27, 2016

See if the following discussion helps solve the issue:

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

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
Explorer ,
May 27, 2016 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.

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
LEGEND ,
May 28, 2016 May 28, 2016
LATEST

Show the code you have for the Enter key.

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