Key is Down bug.

0 favourites
  • 6 posts
From the Asset Store
Random Maze Generator with Door & Key System - tutorial capx
  • Problem Description

    when a form element gain focus, the key is down events continue to fire if the button was being pressed.

    Attach a Capx

    Capx: 1drv.ms/u/s!AhHSZHEulqh_ghe9x15zH6Z6WcoJ

    Description of Capx

    key is down events change text, a form input box to click while key is down.

    When you hold spacebar and click the inputbox, then release spacebar, it continues to fire the key is down event.

    Only when you click off the input and then press spacebar again and release it will it stop firing.

    Expected Result

    the key is down should stop firing if button is released while a form element is focused.

    Affected Browsers

    all

    vista

    r250

  • Also in C3

  • Problem Description

    when a form element gain focus, the key is down events continue to fire if the button was being pressed.

    Attach a Capx

    Capx: 1drv.ms/u/s!AhHSZHEulqh_ghe9x15zH6Z6WcoJ

    Description of Capx

    key is down events change text, a form input box to click while key is down.

    When you hold spacebar and click the inputbox, then release spacebar, it continues to fire the key is down event.

    Only when you click off the input and then press spacebar again and release it will it stop firing.

    Expected Result

    the key is down should stop firing if button is released while a form element is focused.

    Affected Browsers

    all

    vista

    r250

    Make sure to put Ashley or Tom to get their attention.

  • Make sure to put Ashley or Tom to get their attention.

    Report bugs here github.com/Scirra/Construct-3-bugs

  • This was reported as a C2 bug and not a C3 one. Also I think tagging the devs in posts in the bugs section is kind of redundant.

    Anyways, what's happening is the textbox object, once selected, blocks most all input events from passing through it to anything else. So the keyboard state (which is stored in a array in the keyboard object) isn't updated when the spacebar key is released.

    I'm not the developer, but you can make the keyup events not be blocked from the textbox object as a self fix. It would make the key released triggers fire as you type stuff, but perhaps that's acceptable in your case.

    Anyways, set the textbox id property to something like "foo" and then using the browser object run this code:

    start of layout
    -- browser: execute js: "$(document.getElementById('foo')).off('keyup');"

    I don't think it would work in C3 unless jquery is used in the textbox object.

    Alternatively, I guess if you wanted more control you could just do your own textbox with events and filter keyboard events yourself. Last I checked the keyboard object wasn't quite up to snuff to get typed keys with case and such, so you could capture keys with a little js as well. I thought I had posted this before, but I guess not.

    dropbox.com/s/4krzeg2umuhdeth/text_input.capx

    cheers

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks R0J0hound ! That's interesting about the input blocking the events, and that execute js code seems to solve my problem.

    The capx is also interesting, though would be more work to incorporate I think, considering it doesn't have other user-friendly things like selecting text,etc.

    I'm going to use the execjs method!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)