View Full Version : Weird bug
ArmoredSandwich
February 16th, 2008, 06:41 AM
Why is this not working?
if (Key.isDown(49)) // 1
{
if (Key.isDown(17)) // control
{
}
}
And why is this actually.. working?
if (Key.isDown(53)) // 5
{
if (Key.isDown(17)) // control
{
}
}
They're both practical the same as you can see but one is working and the other isn't, wtf?
Thx
Mr beef
February 16th, 2008, 10:21 AM
I get those kind of bugs sometimes where if I give something an instance name it wont work but if I then change it to something else it works fine. Honestly makes no sense to me :/
bluemagica
February 16th, 2008, 11:23 AM
though that looks extremely weird, the problem might originate at some other point in your code, please show a little bit more of your code so that i can try to find the cause.
therobot
February 17th, 2008, 05:16 AM
It seems to work fine on my end. I had to move your comments around because they were giving me some lame auto-formatting errors, but other than that, it was fine.
How are you handling your key presses? onkeydown? onenterframe?
ArmoredSandwich
February 17th, 2008, 07:58 AM
It seems to work fine on my end. I had to move your comments around because they were giving me some lame auto-formatting errors, but other than that, it was fine.
How are you handling your key presses? onkeydown? onenterframe?
keyListener.onKeyDown = function ()
{
And yeah, it does seem to be working fine when I test it in an empty new project. So that made me thinking, I put the code outside the keyListener stuff (listeners aren't exactly my thing :S ) and it worked fine.... Which made me thinking, why would ctrl + 5 work and Ctrl + 1 not.. Weird stuff.
Anyways, thanks for the help..
EDIT: Awesome, even this is working now:
for(var i = 0; i < 10; i ++)
{
if (Key.isDown(48 + i))
{
if (Key.isDown(17))
{
trace ("ctrl + " + i);
}
}
}
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.