It will work if you'll do one of two things:
1) in the initApp() you'll set programmatically focus on t1, like this:
private function initApp():void {
addEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
t1.setFocus();
}
or
2)you'll listen to addedToStage event and add the keyboard event listner to the
stage:
private function addedToStageHandler():void
{
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
}
note that keyboard events are not dispatched unless flash player has system
focus, so you'll have to click flash player area first this to work.