# Controlling scenes with keyboard keys

**URL:** https://forum.kirupa.com/t/controlling-scenes-with-keyboard-keys/61375
**Category:** flash
**Created:** [August 18, 2004, 2:40am UTC](https://forum.kirupa.com/t/controlling-scenes-with-keyboard-keys/61375 "2004-08-18T02:40:11Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![aherrera](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/aherrera/32/300_2.png) [@aherrera](https://forum.kirupa.com/u/aherrera)
#### Post date: [August 18, 2004, 2:40am UTC](https://forum.kirupa.com/t/controlling-scenes-with-keyboard-keys/61375/1 "2004-08-18T02:40:11Z")

</div>

Does anyone know a good way to be able to go back and forth between scenes by using keyboard keys (for instance, the left and right arrows)? Or perhaps point me in the right direction?

Thanks!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 18, 2004, 3:52am UTC](https://forum.kirupa.com/t/controlling-scenes-with-keyboard-keys/61375/2 "2004-08-18T03:52:09Z")

</div>

> [@aherrera](#):
>
> Does anyone know a good way to be able to go back and forth between scenes by using keyboard keys (for instance, the left and right arrows)? Or perhaps point me in the right direction?
> 
> Thanks!

```php

function onKeyDown () {
	if (Key.isDown (Key.LEFT)) {
		prevScene ();
	} else if (Key.isDown (Key.RIGHT)) {
		nextScene ();
	};
};

Key.addListener (this);

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 18, 2004, 2:25pm UTC](https://forum.kirupa.com/t/controlling-scenes-with-keyboard-keys/61375/3 "2004-08-18T14:25:56Z")

</div>

> [@arcaRox](#):
>
> ```php
> 
> function onKeyDown () {
> if (Key.isDown (Key.LEFT)) {
> prevScene ();
> } else if (Key.isDown (Key.RIGHT)) {
> nextScene ();
> };
> };
> 
> Key.addListener (this);
> 
> ```

A-ha! I was so close! Thanks so much!
