ok, I dug around the forum and found out that it is a bug in flash 8... something macromedia should fix asap me think... or is it fixed? im using 8.0...
but here is a .fla from another thread regardning the same situation. publish this one as MX2004/flash7 first, then, switch to flash 8 and try holding several keys... and... bug! flash fails to catch onKeyUp's... if you can make it this one work as flash 8 my, and it seems, many others problem is solved... (my game uses bitmapdata everywhere and scrollrect so MX 2004/flash7 isn't an option here...)
So onKeyUp seems to be notified only for the last key that notified onKeyDown... anyone recognize and have some solution to this problem? (I'm using flash 8.)
Well, not exactly true. onKeyUp is notified but the problem is that Key.getCode() returns the code of the last pressed button.
I guess a work around would be to check on each frame if shift or control are pressed with Key.isDown() method and if not the flipper is up and if yes flipper is down.
Last edited by Smilev; 02-26-2006 at 08:41 PM.
while (2+2 == 4) {
drink ("bourbon");
}
gotoAndStop("bed");
ok, I dug around the forum and found out that it is a bug in flash 8... something macromedia should fix asap me think... or is it fixed? im using 8.0...
It's not really a bug but it's how the getCode method works.
while (2+2 == 4) {
drink ("bourbon");
}
gotoAndStop("bed");
Well, not exactly true. onKeyUp is notified but the problem is that Key.getCode() returns the code of the last pressed button.
I guess a work around would be to check on each each frame if shift or control are pressed with Key.isDown() method and if not the flipper is up and if yes flipper is down.
ok, well i tried a Key.isDown() modification but problem remains... check the .fla i posted above! it uses isDOwn.
Well, I wanted to look at your .fla because I don't think you implemented it properly.
It should be
keyListenerName.onKeyUp = function() {
}
keyListerName being the name you gave your keyListener
not
keyListener.onKeyUp = function() {
}
yeah, keyListener is the name of the object,
PHP Code:
var keyListener:Object = new Object();
//.
//.
//onkey function definitions and stuff
//.
//.
Key.addListener(keyListener);
anyway, the problem is stated earlier, compare the above key-jam.fla between flash7 & flash8 exports and it should be clear... can't see another explenation than it is a bug causing it.
Disregard my last post. You are right, when using Listeners it works when published as Flash7 but not as Flash8. I didn't read carefully your post. BUt you didnt read carefully my either. I said a work around is to check each frame if a key isDown not to use it with listener.
Here is the correct example. The code is on the two movieclips.
while (2+2 == 4) {
drink ("bourbon");
}
gotoAndStop("bed");
var keyListener:Object = new Object();
//.
//.
//onkey function definitions and stuff
//.
//.
Key.addListener(keyListener);
anyway, the problem is stated earlier, compare the above key-jam.fla between flash7 & flash8 exports and it should be clear... can't see another explenation than it is a bug causing it.
Disregard my last post. You are right, when using Listeners it works when published as Flash7 but not as Flash8. I didn't read carefully your post. BUt you didnt read carefully my either. I said a work around is to check each frame if a key isDown not to use it with listener.
Here is the correct example. The code is on the two movieclips.