# Arrow key movement: change direction

**URL:** <https://forum.kirupa.com/t/arrow-key-movement-change-direction/283714>\
**Category:** flash\
**Created:** [March 10, 2009, 10:27am UTC](https://forum.kirupa.com/t/arrow-key-movement-change-direction/283714 "2009-03-10T10:27:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiwi79](https://avatars.discourse-cdn.com/v4/letter/k/e68b1a/32.png) [@kiwi79](https://forum.kirupa.com/u/kiwi79)\
**Post date:** [March 10, 2009, 10:27am UTC](https://forum.kirupa.com/t/arrow-key-movement-change-direction/283714/1 "2009-03-10T10:27:47Z")

</div>

function moveStuff(){  
if(Key.isDown(Key.DOWN)){  
this.\_y += 5;  
}  
if(Key.isDown(Key.UP)){  
this.\_y -= 5;  
}  
if(Key.isDown(Key.LEFT)){  
this.\_x -= 5;  
}  
if(Key.isDown(Key.RIGHT)){  
this.\_x += 5;  
}  
}  
lp\_mc.onEnterFrame=moveStuff;

* * *

thats my basic Arrow key functions to move a movie clip

lp\_mc is my character in the left position so when left key is pressed it moves forwards but when right is presssed it moves backwards…

i have a movieclip called rp\_mc which is the same thing but facing the other way

when right is pressed how do i swap the lp\_mc for rp\_mc so it changes direction?
