1046: Type was not found or was not a compile-time constant: KeyBoardEvent

Okay, I am new to AS3, and I am going through the classroom in a book for Fash 4, AS3. In Chapter 3, it says I should be able to make a ball bounce from 2 or more sides of the stage. I haven’t been able to figure out how to do that(I can make it move in different directions - but not bounce and change directions), so I found a tutorial online, but it is in AS2. I have tried to rewrite the code so that it is in AS3, but I keep getting this error:
[FONT=Times New Roman][SIZE=3]1046: Type was not found or was not a compile-time constant: KeyBoardEvent.[/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3][/SIZE][/FONT]
The code is on the timeline and I have included the following in my script.

[FONT=Times New Roman] import flash.display.Stage;
import flash.events.*;
import flash.events.KeyboardEvent;
import flash.display.MovieClip;
import flash.ui.Keyboard;[/FONT]
[FONT=Times New Roman][/FONT]
[FONT=Times New Roman]stage.addEventListener(KeyboardEvent.KEY_DOWN, moveBall);
stage.addEventListener(KeyboardEvent.KEY_DOWN, applyMovement);[/FONT]
[FONT=Times New Roman][/FONT]
The error comes on the first line of the function code(s) in the following (specific line in italics):

[FONT=Times New Roman]function moveBall(event:KeyBoardEvent): void {

  • if (event.keyCode == 39) {*
    xSpeed += ballSpeed;
    }
    if (event.keyCode == 37) {
    xSpeed -= ballSpeed;
    }
    if (event.keyCode == 40) {
    xSpeed += ballSpeed;
    }
    if (event.keyCode == 38) {
    xSpeed -= ballSpeed;
    }
    }[/FONT]
    [FONT=Times New Roman]function applyMovement(event:KeyBoardEvent): void {
    ball.x = xSpeed;
  • ball.y = ySpeed;
  • ball.rotation = xSpeed;[/FONT]

I have looked online and in the AS3 bible and not found a solution. I can’t seem to find a solution on any other forums either. Your help is appreciated. Also if this thread a repeat of another one on this site. I apologize.

Thanks!