# Keyboard left/right control converting as3 to as2

**URL:** <https://forum.kirupa.com/t/keyboard-left-right-control-converting-as3-to-as2/326845>\
**Category:** Uncategorized\
**Created:** [January 16, 2012, 12:32pm UTC](https://forum.kirupa.com/t/keyboard-left-right-control-converting-as3-to-as2/326845 "2012-01-16T12:32:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rojere](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@rojere](https://forum.kirupa.com/u/rojere)\
**Post date:** [January 16, 2012, 12:32pm UTC](https://forum.kirupa.com/t/keyboard-left-right-control-converting-as3-to-as2/326845/1 "2012-01-16T12:32:59Z")

</div>

here is a code that was done in as3  
it allows the user to use the keyboard keys to go laft and right from frame to frame

stage.addEventListener(KeyboardEvent.KEY\_DOWN, fl\_changeSlide);  
function fl\_changeSlide(evt:KeyboardEvent):void  
{  
if(evt.keyCode == 37) // LEFT  
{  
gotoAndStop(this.currentFrame-1);  
}  
else if (evt.keyCode == 39 || evt.keyCode == 32) // RIGHT OR SPACE  
{  
gotoAndStop(this.currentFrame+1);  
}  
}  
stop();

but i need to know how to do it in as2  
if at all possible
