# "Switch/Case" syntax with simultaneous keypress

**URL:** https://forum.kirupa.com/t/switch-case-syntax-with-simultaneous-keypress/193638
**Category:** flash
**Created:** [July 14, 2006, 5:55pm UTC](https://forum.kirupa.com/t/switch-case-syntax-with-simultaneous-keypress/193638 "2006-07-14T17:55:05Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Jayme65](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@Jayme65](https://forum.kirupa.com/u/Jayme65)
#### Post date: [July 14, 2006, 5:55pm UTC](https://forum.kirupa.com/t/switch-case-syntax-with-simultaneous-keypress/193638/1 "2006-07-14T17:55:05Z")

</div>

Hi, may I submit you this question:

```auto

function stageKey() {
 //press "left"
 if (Key.getCode() == 37) {
  trace("left");
 }
 //hold "q" while pressing left
 if (Key.isDown(81) && Key.getCode() == 37) {
  trace("q+left");
 }
}
var keyListener:Object = new Object();
keyListener.onKeyDown = stageKey;
Key.addListener(keyListener);

```

If I press “left”…OK it displays “left”  
If I hold “q” then press “left” it will display “left” PLUS “q+left”

1. What to do to have it verify the second condition only (“q+left”), in other terms when both keys are pressed only have “q+left” displayed, without each seperate key more.
2. What would be the syntax using switch/case when there’s a cunjonction of key pressed?
