# Key.addlistener problem

**URL:** <https://forum.kirupa.com/t/key-addlistener-problem/170718>\
**Category:** Uncategorized\
**Created:** [November 29, 2005, 2:37am UTC](https://forum.kirupa.com/t/key-addlistener-problem/170718 "2005-11-29T02:37:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonoda](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@jasonoda](https://forum.kirupa.com/u/jasonoda)\
**Post date:** [November 29, 2005, 2:37am UTC](https://forum.kirupa.com/t/key-addlistener-problem/170718/1 "2005-11-29T02:37:41Z")

</div>

im using key.addlisteners to check for key presses. but if a person presses all 3 keys at once (RIGHT, LEFT, UP) then releases one at a time, only the first release is noted by flash. see a demo at:

[http://www.starvingeyes.com/temp/listener.swf](http://www.starvingeyes.com/temp/listener.swf)

is there any way to solve this?

NOTE: I do not want to use if(Key.isDown…etc) to get this to work. if you are interested in why see below.

here is the code:  
[color=Red]  
myListener = new Object();  
myListener.onKeyDown = function() {  
if (Key.getCode()==39) {  
rb=true;  
}  
if (Key.getCode()==38) {  
ub=true;  
}  
if (Key.getCode()==37) {  
lb=true;  
}  
if (Key.getCode()==32) {  
sb=true;  
}  
}  
myListener.onKeyUp = function() {  
code= Key.getCode()  
if (code==39) {  
rb=false;  
}  
if (code==38) {  
ub=false;  
}  
if (code==37) {  
lb=false;  
}  
if (code==32) {  
sb=false;  
}  
}  
Key.addListener(myListener);[/color]

i want to publish my movie with WMODE set to transparent windowless. there is a glitch in flash that makes it so if(key.isDown(key.right)) sort of codes dont work in anything but IE when WMODE is set this way. therefore i am looking for any alternative to this. let me know if you have any others.
