# Multiple Key Presses ( AS3 )

**URL:** <https://forum.kirupa.com/t/multiple-key-presses-as3/274776>\
**Category:** flash\
**Created:** [November 4, 2008, 5:39pm UTC](https://forum.kirupa.com/t/multiple-key-presses-as3/274776 "2008-11-04T17:39:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![j\_mylne\_talk21](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@j\_mylne\_talk21](https://forum.kirupa.com/u/j_mylne_talk21)\
**Post date:** [November 4, 2008, 5:39pm UTC](https://forum.kirupa.com/t/multiple-key-presses-as3/274776/1 "2008-11-04T17:39:24Z")

</div>

How can we know when 2 keyboard keys are pressed at the same time, example LEFT and UP keys?  
I read the first 3 pages of this:  
[http://www.kirupa.com/developer/actionscript/multiple\_key\_detection.htm](http://www.kirupa.com/developer/actionscript/multiple_key_detection.htm)  
but the tutorial centers on the ctrl + keyCode only.  
this does not work ( only detects 1st key / one of the keys pressed ):

stage.addEventListener( KeyboardEvent.KEY\_DOWN, handleKeyDown );

function handleKeyDown( event:KeyboardEvent ):void {  
// LEFT = 37, UP = 38, RIGHT = 39, DOWN = 40  
if ( event.keyCode == 37 && event.keyCode == 38 ) {  
trace( " huraaah! " );  
}  
}
