facebook

How To Make A Running Count: CLOSED

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #323223 Reply

    713ace
    Member

    I have 15 diffreent buttons on the screen. I would like to make it so that 5 of them add 1 to the count and 5 of them subtract one from the count and three of them to do nothing, and one to reset the count to zero. I would like the count to appear on the screen. Can someone please help me by giving me code or explaing how to do this???
    Thanks
    Andrew

    #323247

    support-michael
    Keymaster

    @713ace

    This should not be too hard.

    1) create global var, COUNTER
    COUNTER = 0;
    – in the youruifile_export.js file (youryuifile is the name of your UI file)
    2) for buttons that increment counter, add RUN JS action code
    COUNTER++;
    3) for buttons that decrement counter, add RUN JS action code
    COUNTER–;
    4) for reset button, add RUN JS action code
    COUNTER=0;

    Q: can COUNTER be negative?
    If no then use for #3 above use this snippet which will never allow COUNTER to be less than zero
    COUNTER = Math.max(0,–COUNTER)

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: How To Make A Running Count: CLOSED

You must be logged in to post in the forum log in