I don’t understand why I am getting this error: Scene 1, Layer 1’, Line 32 1120: Access of undefined property keyHandler. Code looks fine to me. Maybe If you guys have a close look perhaps you can identify the problem thanks. btn_one.addEventListener(MouseEvent.CLICK, btnSubmit);
stage.addEventListener(KeyboardEvent.KEY_UP, keyHandler); //ERROR LINE
function btnSubmit(event:Event):void{
if(txt_input.text != “”){
txt_area.text += txt_input.text + ’
';
txt_area.verticalScrollPosition = txt_area.maxVerticalScrollPosition;
txt_input.text = “”;
txt_input.setFocus();
function keyHandler(event:KeyboardEvent):void{
if(event.keyCode == Keyboard.ENTER){
trace(“Key pressed”);
}
if(txt_input.text != “”){
txt_area.text += txt_input.text + ’
';
txt_area.verticalScrollPosition = txt_area.maxVerticalScrollPosition;
txt_input.text = “”;
txt_input.setFocus();
}
}
}
}