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
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 ?