# Keyboard navigation

**URL:** https://forum.kirupa.com/t/keyboard-navigation/235152
**Category:** Uncategorized
**Created:** [August 8, 2007, 9:17pm UTC](https://forum.kirupa.com/t/keyboard-navigation/235152 "2007-08-08T21:17:03Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Caryn1980](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@Caryn1980](https://forum.kirupa.com/u/Caryn1980)
#### Post date: [August 8, 2007, 9:17pm UTC](https://forum.kirupa.com/t/keyboard-navigation/235152/1 "2007-08-08T21:17:03Z")

</div>

I’m making a presentation in flash with the arrow keys as navigation. I have it set up by section in my .fla. I have an intro in the main timeline for about 30 seconds. After that, it stops at the last frame of the intro. On that frame in the main timeline, I have action script to then play a movie clip when the arrow key is pressed. Here is the code I used:

this.onKeyDown = function() {  
if (Key.getCode() == (Key.RIGHT)) {  
gotoAndPlay(“greenBox\_mc”);  
Key.removeListener(this);  
}  
};  
Key.addListener(this);

Each section of the presentation has it’s own movie clip that is accessed with the same script above. I have the AS for the Left arrow key at the end of each movie clip. That looks like this:

stop();  
this.onKeyDown = function() {  
if (Key.getCode() == (Key.LEFT)) {  
gotoAndPlay(1);  
Key.removeListener(this);  
}  
};  
Key.addListener(this);

Then, in the middle of every other movie clip, I want it to stop and wait for the user to click one of the arrow keys. If they press left, I want it to go to the previous movie clip. If they press right, I want it to go to the next frame in the movie clip it’s already in. I can’t get this part to work properly. This is the AS I put for that part:

stop();  
this.onKeyDown = function() {  
if (Key.getCode() == (Key.RIGHT)) {  
gotoAndPlay(41);  
Key.removeListener(this);  
}
