# Character Movement

**URL:** <https://forum.kirupa.com/t/character-movement/250131>\
**Category:** Uncategorized\
**Created:** [January 25, 2008, 9:00pm UTC](https://forum.kirupa.com/t/character-movement/250131 "2008-01-25T21:00:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![frenchcs1](https://avatars.discourse-cdn.com/v4/letter/f/bcef8e/32.png) [@frenchcs1](https://forum.kirupa.com/u/frenchcs1)\
**Post date:** [January 25, 2008, 9:00pm UTC](https://forum.kirupa.com/t/character-movement/250131/1 "2008-01-25T21:00:27Z")

</div>

Sorry if this has been covered before because well its a very simple conscept but I can not seem to be able to find the answer to it. I am trying to register two key presses at the same time. For instance if I want my character to move diagonally I would press UP and LEFT or something like that. However my old way of doing this was with the isDown function which they have decided to remove from AS3.0 so I was trying listeners but they only register the last key pressed down. This is my code:

stage.addEventListener(KeyboardEvent.KEY\_DOWN, keyHandler);  
function keyHandler(event:KeyboardEvent):void {  
if (event.keyCode == 37) {  
PlayMove.x = PlayMove.x - 1;  
}  
if (event.keyCode == 38) {  
PlayMove.y = PlayMove.y - 1;  
}  
if (event.keyCode == 39) {  
PlayMove.x = PlayMove.x + 1;  
}  
if (event.keyCode == 40) {  
PlayMove.y = PlayMove.y + 1;  
}  
}

Hopefully someone can help me out. Thanks.
