Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now