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

Keyboard Even (key down) not working on Mac

Participant ,
Mar 20, 2014 Mar 20, 2014

I have been using this AS3 code to detect keyboard arrow presses:

Global function keyDownHandler(event:KeyboardEvent):void {

    trace("keyDownHandler: " + event.keyCode);

    trace("ctrlKey: " + event.ctrlKey);

    trace("keyLocation: " + event.keyLocation);

    trace("shiftKey: " + event.shiftKey);

    trace("altKey: " + event.altKey);

   

    if(event.keyCode == 39 ) {

        nextFrame();

        //zoom_pics.nextFrame();

    } else if(event.keyCode == 37 ) {

        prevFrame();

        //zoom_pics.prevFrame();

    }

}

stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);

My customer/client says that the navigation isn't working on their Mac. I've published the SWF with an HTML file. It works fine on my PC. Has anyone seen this also? Does anyone have a solution?

TOPICS
ActionScript
425
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 ,
Mar 21, 2014 Mar 21, 2014
LATEST

The browser window has to be in focus. Tell your user that they need to actually click on the browser window first, so that the keystrokes will be used by the browser.

Alternately, you can force the focus by starting your movie with something that the user has to click on to begin. This will bring the keyboard focus to the browser window.

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