# Movement by keys

**URL:** <https://forum.kirupa.com/t/movement-by-keys/156259>\
**Category:** flash\
**Created:** [July 24, 2005, 11:51am UTC](https://forum.kirupa.com/t/movement-by-keys/156259 "2005-07-24T11:51:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fatratstew](https://avatars.discourse-cdn.com/v4/letter/f/d9b06d/32.png) [@fatratstew](https://forum.kirupa.com/u/fatratstew)\
**Post date:** [July 24, 2005, 11:51am UTC](https://forum.kirupa.com/t/movement-by-keys/156259/1 "2005-07-24T11:51:11Z")

</div>

Here is the code I am currently using.  
(The instance name being mcBox)

One problem I am having is a slight delay between pressing the key and the symbol moving.  
Another problem is I would like the movieclip symbol to play its own timeline when a key is pressed.

on (keyPress “\<Left\>”) {  
currentX = this.\_x;  
this.\_x = currentX - 10;  
\_root.mcBox.\_rotation = 270;  
}  
on (keyPress “\<Right\>”) {  
currentX = this.\_x;  
this.\_x = currentX + 2;  
\_root.mcBox.\_rotation = 90;  
}  
on (keyPress “\<Up\>”) {  
currentY = this.\_y;  
this.\_y = currentY - 2;  
\_root.mcBox.\_rotation = 360;  
}  
on (keyPress “\<Down\>”) {  
currentY = this.\_y;  
this.\_y = currentY + 2;  
\_root.mcBox.\_rotation = 180;  
}

Any ideas?
