# Keyboard error 1120 access of undefined property

**URL:** <https://forum.kirupa.com/t/keyboard-error-1120-access-of-undefined-property/331413>\
**Category:** Uncategorized\
**Created:** [July 26, 2013, 1:13pm UTC](https://forum.kirupa.com/t/keyboard-error-1120-access-of-undefined-property/331413 "2013-07-26T13:13:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![quest20](https://avatars.discourse-cdn.com/v4/letter/q/a87d85/32.png) [@quest20](https://forum.kirupa.com/u/quest20)\
**Post date:** [July 26, 2013, 1:13pm UTC](https://forum.kirupa.com/t/keyboard-error-1120-access-of-undefined-property/331413/1 "2013-07-26T13:13:15Z")

</div>

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();  
}

}

}  
}
