Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Increase/Decrease Value with Keys

  • Increase/Decrease Value with Keys

    Posted by Tudor Baican on February 9, 2023 at 9:59 pm

    Hello Friends,

    i have in my Ui some editText-field to input some values.

    I would like to increase / decrease the value with the up and down key.

    So far so good, it actually works but the value in the field gets increase by the double value.

    What’s wrong? Thanks for your help!

    myTextfield.addEventListener('keydown', keyFunc); 


    function keyFunc(){

    var myKeyState = ScriptUI.environment.keyboardState;

    if(myKeyState.keyName=="Up"){

    this.text = parseInt(this.text)+1;


    };

    Tudor Baican replied 3 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Graham Quince

    February 11, 2023 at 10:43 am

    Key up and key down functions can be notorious difficult to capture once, quite often they’ll record double presses. If it is consistently doubling, maybe the simplest approach is to add 0.5 each time instead of 1.

  • Tudor Baican

    February 11, 2023 at 4:34 pm

    Hmmm ok, Strange behavior 🙃

    Sure, to add 0.5 works, I was thinking I forget something.

    Thanks. 👍

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy