Navigating with Arrow Keys - AS3
Hello,
I am currently making a presentation where I need to use the left and right arrow keys to navigate movie clips. Everything seems to be working fine with the exception of the left arrow key. Here is my code.
This code is on frame 35 inside a movie clip. This movie clip is on Scene1, frame 3. The left key (37) will take the user back to Scene1, frame 2. The right key (39) will take the user to frame 36 on this movie clip.
stop();
stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_KeyboardDownHandler);
function fl_KeyboardDownHandler(event:KeyboardEvent){
if (event.keyCode == 37){
MovieClip(parent).gotoAndStop(2);
}
else if (event.keyCode == 39){
gotoAndPlay(36);
}
}This seems to work fine. However, when I have another action further down the timeline of this movie clip, the left key still wants to go to Scene 1, frame 2 and not to a frame within the movie clip. Here on frame 55 in the movie clip, the left key should take the user to frame 35 and the right key to frame 56. The right key works but the left key does not.
stop();
stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_KeyboardDownHandler2);
function fl_KeyboardDownHandler2(event:KeyboardEvent){
if (event.keyCode == 37){
gotoAndStop(35);
}
else if (event.keyCode == 39){
gotoAndPlay(56);
}
}Any help would be greatly appreciated. Also, if you need more information please let me know.
Thanks,
Shannon
