# Trouble with keyboard events

**URL:** https://forum.kirupa.com/t/trouble-with-keyboard-events/301859
**Category:** Uncategorized
**Created:** [December 16, 2009, 10:50pm UTC](https://forum.kirupa.com/t/trouble-with-keyboard-events/301859 "2009-12-16T22:50:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![handless](https://avatars.discourse-cdn.com/v4/letter/h/b4bc9f/32.png) [@handless](https://forum.kirupa.com/u/handless)
#### Post date: [December 16, 2009, 10:50pm UTC](https://forum.kirupa.com/t/trouble-with-keyboard-events/301859/1 "2009-12-16T22:50:20Z")

</div>

Hello

Ive been working on creating a 3d earth using papervision, I got it working however I want to add the ability to zoom in and out using the + and - keys, however I cant seem to get it to work. below is what im using.

in the main function:

```auto

addEventListener( KeyboardEvent.KEY_DOWN, keyDownHandler );

```

the keyDownHandler function:

```auto

private function keyDownHandler( event:KeyboardEvent ):void
{
     switch (event.keyCode)
     {
          case 107:
               _camera.zoom += 10;
               break;
          case 109:
               _camera.zoom -= 10;
               break;
     }
}

```

any help would be awesome.
