# as2 - disable keydown function

**URL:** <https://forum.kirupa.com/t/as2-disable-keydown-function/294473>\
**Category:** flash\
**Created:** [August 14, 2009, 2:21pm UTC](https://forum.kirupa.com/t/as2-disable-keydown-function/294473 "2009-08-14T14:21:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![danny\_brooks](https://avatars.discourse-cdn.com/v4/letter/d/a5b964/32.png) [@danny\_brooks](https://forum.kirupa.com/u/danny_brooks)\
**Post date:** [August 14, 2009, 2:21pm UTC](https://forum.kirupa.com/t/as2-disable-keydown-function/294473/1 "2009-08-14T14:21:34Z")

</div>

is there a way to disable the left arrow key for a certain part of a movie. i have the follow code to make it work but need the code to disable it.

//listen for keypress

var myListener:Object = new Object();  
myListener.onKeyDown = function() {  
if (Key.getCode() == Key.LEFT) {  
\_global.slidecounter -= 2;  
gotoAndPlay(2);  
} else if (Key.getCode() == Key.RIGHT) {  
slidePlayer.play();  
} else if (Key.getCode() == Key.DOWN) {  
gotoAndPlay(2);  
} else if (Key.getCode() == Key.UP) {  
\_global.slidecounter -= 2;  
gotoAndPlay(2);  
}  
};  
Key.addListener(myListener);

any help would be great thanks, Dan
