# Return Key presses (AS2)

**URL:** <https://forum.kirupa.com/t/return-key-presses-as2/242091>\
**Category:** flash\
**Created:** [October 22, 2007, 12:24pm UTC](https://forum.kirupa.com/t/return-key-presses-as2/242091 "2007-10-22T12:24:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lilleypants](https://avatars.discourse-cdn.com/v4/letter/l/f17d59/32.png) [@lilleypants](https://forum.kirupa.com/u/lilleypants)\
**Post date:** [October 22, 2007, 12:24pm UTC](https://forum.kirupa.com/t/return-key-presses-as2/242091/1 "2007-10-22T12:24:03Z")

</div>

I have code on my flash that allows the user to tab to certain buttons and press enter to enter it… but when ever I hit return with the keypress code it wipes the .swf file and goes blank… is this something to do with refreshing? Can anyone point out where I am going wrong… thanks 🙂

```auto
 
var EscapeListener:Object = new Object();
EscapeListener.onKeyDown = function() {
 
 if (Key.getCode() == 27) {
  
  _root.exitP_mc._visible = false;
  _root.alpha_mc._visible = false;
  
 } else if (Key.getCode() == 13) {
 
root.exitP_mc._visible = false;
  _root.alpha_mc._visible = false;
 
 }
};
Key.addListener(EscapeListener);

```
