# \[Flash8\] Keylistener on multiple keys

**URL:** <https://forum.kirupa.com/t/flash8-keylistener-on-multiple-keys/226575>\
**Category:** flash\
**Created:** [May 22, 2007, 12:47pm UTC](https://forum.kirupa.com/t/flash8-keylistener-on-multiple-keys/226575 "2007-05-22T12:47:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![coggia](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@coggia](https://forum.kirupa.com/u/coggia)\
**Post date:** [May 22, 2007, 12:47pm UTC](https://forum.kirupa.com/t/flash8-keylistener-on-multiple-keys/226575/1 "2007-05-22T12:47:14Z")

</div>

Hello,  
I got a little problem on a simple code:  
There are 5 Mcs on stage named Key1 to Key5. I got a listener on keyboard that put the mc alpha to 40 if you press the key of the mc (1 - 5), and turn the alpha to 100 if key isn’t pressed

```auto

var keyListener:Object = new Object();
    
    keyListener.onKeyDown = function() {

    if (Key.isDown(49))key1._alpha=40;
    if (Key.isDown(50))key2._alpha=40;
        if (Key.isDown(51))key3._alpha=40;
        if (Key.isDown(52))key4._alpha=40;
        if (Key.isDown(53))key5._alpha=40;
       }

keyListener.onKeyUp = function() {

    if (!Key.isDown(49))key1._alpha=100;
    if (!Key.isDown(50))key2._alpha=100;
        if (!Key.isDown(51))key3._alpha=100;
        if (!Key.isDown(52))key4._alpha=100;
        if (!Key.isDown(53))key5._alpha=100;
       }
Key.addListener(keyListener);

```

The problem is that it works perfectly if you press a key at time, but it don’t work if you press the 5 keys simultaneously , (make strange things :‘1’ to ‘4’ pressed works, but ‘3’ to ‘5’ make the 5th mc as un-pressed)  
Is there a fine way to test if the 3 simultaneous keys (char ‘3’ to ‘5’) are pressed ?
