[AS3] keyboard event wont work :(

I decided to pick up a copy of O’reilly Actionscript 3 Cookbook today, and I have been going through. One of the first examples it has for keyboard events is:

package {
    import flash.display.Sprite;
    import flash.events.KeyboardEvent;
    public class ExampleApplication extends Sprite {
        public function ExampleApplication(  ) {
            stage.focus = this;
            addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
        private function onKeyDown(event:KeyboardEvent):void {
            trace("key down: " + event.charCode);

But for some reason it will not work. According to the book stage.focus = this; is all you need for keyboard events to work, am i doing something wrong?