KeyDown()-Bug in Flash

Monkey Forums/Monkey Bug Reports/KeyDown()-Bug in Flash

Zwer99(Posted 2013) [#1]
Hello,

I tried to find the bug, I posted in the flash subforum, but I couldn't find any solution...

I just found out, that the speed of the computer is relevant. Please, try it out:

Test-App

On the left side there's a small text. It should mean "KeyDown(KEY_RIGHT): 0 or 1". When you try it out, then look at this text and you'll see that sometimes it shwos 1 even if the player doesn't press the right-key.
The best way to reproduce the bug is to press randomly left or right for just a very short time. It's more like hitting the keys ;)

The code is also nothing special:
Method Update:Void()
	player.Update()		'Here I check KeyDown(LEFT,RIGHT) and set SpeedX
	player.move()		'Move the player X = X + SpeedX
End

Method Render:Void()
	player.Draw()		'Draws the player on Screen
	'Printing text
End


Try it out with Internet Explorer or Firefox and if you use a fast PC, the bug doesn't appear!

I hope there'll be a solution soon! Thank you!

Here's my equipment:
1. PC: Windows 8, Monkey 66b and Monkey 62, Speed of computer: middle - problem occures
2. PC: Windows 7, Monkey 66b, Speed: relatively fast - no problem
3. PC: Windows 8, Monkey 66b, Speed: fast - no Problem
4. PC: Windows Vista, Monkey 66b, Speed: slow - Problem occures


slenkar(Posted 2013) [#2]
this might be a problem with flash, quite often i play a game and the left or right key is detected as pressed

to fix it i just press the right key again and it stops


Zwer99(Posted 2013) [#3]
So I can't do anything? Can I just hope that Adobe solves the bug one day? It wouldn't be a problem if it happens one time in a minute, but it happens more often and the final game won't be playable because the player would always die :(


Zwer99(Posted 2013) [#4]
I just played Snailiad and it has the same problem! Now I'm sure that's Adobe's fault!


slenkar(Posted 2013) [#5]
go into your build folder and find config.monkey
change the filtering option to False
compile your game again
and see a speed improvement


Zwer99(Posted 2013) [#6]
Haha! That's exactly my next problem! Even if I set image filtering to false, I get following:



It's still set to false. I also turned off image filtering in monkey/targets.
In the compiled MonkeyGame.as I have this line:
internal static var MOJO_IMAGE_FILTERING_ENABLED:String="0"

It seems that Monkey works correctly.
Then I tried to manually change the last parameter of each bitmapData.draw in MonkeyGame.as to "false" - with no effect.

Now I don't know if image filtering is really off :)


slenkar(Posted 2013) [#7]
your problem is that you need black lines between the blocks or you DONT need black lines?

this could be due to scaling, image filtering doesnt affect that


Zwer99(Posted 2013) [#8]
No, I don't need black lines. Everything should be one massive block. Yes, I use scaling. Can't I turn off anti aliasing? Is it impossible to use a tilemap together with aspac ratio?


slenkar(Posted 2013) [#9]
simple solution
make the blocks one pixel larger,

its a primitive solution but for some reason scaling messes things up slightly

it has nothing to do with image filtering whatsoever


Zwer99(Posted 2013) [#10]
Thank you! It works! Yea, you made my day ;)


slenkar(Posted 2013) [#11]
yw


rIKmAN(Posted 2013) [#12]
Is this related to to drawing at Float pixel co-ordinates when scaling?


slenkar(Posted 2013) [#13]
I think so, why?