# keyDown to frame question

**URL:** https://forum.kirupa.com/t/keydown-to-frame-question/224712
**Category:** flash
**Created:** [May 4, 2007, 5:30pm UTC](https://forum.kirupa.com/t/keydown-to-frame-question/224712 "2007-05-04T17:30:35Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mpr](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@mpr](https://forum.kirupa.com/u/mpr)
#### Post date: [May 4, 2007, 5:30pm UTC](https://forum.kirupa.com/t/keydown-to-frame-question/224712/1 "2007-05-04T17:30:35Z")

</div>

I have code that, when pressing the left or right key, will go to the next frame within my movie:

```auto
stop();

this.onKeyDown = function() {
    if (Key.getCode() == Key.LEFT) {
        this.prevFrame();
    } else if (Key.getCode() == Key.RIGHT) {
        this.nextFrame();
    } 
};
Key.addListener(this);

```

However, this will go to the next frame and stop.

How can I get it so it will go to the next frame and play through the time line until I put in a stop command?  
Or, along the same lines, how could I set it so on keyDown it will go to and play whatever frame I choose?
