Swallowing the Windows key

Hi everyone,

During testing I noticed some of the testers would accidentally hit the Windows key, and be torn from the game back to the Start Menu in Windows. It’s a HaxeFlixel-based game, but I’m pretty sure there’s no flixelish way to swallow the keypress, so what I was trying to do was simply this. In Main.new():

    Lib.current.stage.addEventListener(KeyboardEvent.KEY_DOWN, stopEvent);
    Lib.current.stage.addEventListener(KeyboardEvent.KEY_UP, stopEvent);

And in Main:

function stopEvent(e:Dynamic)
{
    if (e.keyCode == 15) {
        e.stopPropagation();
        e.stopImmediatePropagation();
    }
}

But it doesn’t prevent anything, unfortunately. With a trace statement in stopEvent() I can verify that it is in fact being called on down/up with code 15, but the two stop*() calls don’t seem to do what I would like them to.

Any advice?

Thanks,
Gimmicky

Hello,

Unfortunately I think you can’t do anything against this, maybe you stop the propagation for your game but not for the OS. Even in AAA games this key isn’t catch, it’s so close to Alt T_T
To get rid of this i bought a keyboard that can deactivate this **** key

1 Like

Wow. That’s cruddy.

OK, well thanks for confirming, I won’t pull my hair out anymore about it. :slight_smile: