0 Favourites

Reset state of button after 2th click

  • I got big problem when I want to reset value of Global variable and Button text.

    My purpose:

    1. In initial time, my Button have text = "Start" and Global variable isMoving == 1.

    2. After first click my Button must have text = "Stop" and Global variable isMoving is reset to isMoving == 0.

    3. After second click my Button must have text = "Start" again and Global variable isMoving must be equal 1.

    But actually, when program is launched, my Button text == "Start" after few clicks..?? and I guess my Global variable isMoving == 0.... <img src="smileys/smiley3.gif" border="0" align="middle" />

    Could some one help me pls. Because very specific purpose I could use only one button.

    My program like below

    Global number isMoving =1

    Button     |     On clicked

              (if)     System|isMoving = 0 -->Button|Set text to "Stop"

                        -     -->System|Set isMoving to 1

              (else)     System|isMoving = 1 --> Button|Set text to "Start"

                             -->System|Set isMoving to 0

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Ive had this happen to me. I usually put a 0.1 or 0.5 second delay after the click is executed. Whats happening is if you click its checking to see if the variable is 1. Once you click it changes into 1 instantly and doesn't know you want it to toggle. Its instant. Try putting in a delay in there.

  • Dear AarongamerX

    Thank so much for your quick reply

    I change my program like that, but same result..??

    Where I must put System.DelayTime ???

    Global number isMoving =1

    Button|On clicked -->System|wait 0.5 seconds

              [SubEvent](if)     System|isMoving = 0 -->Button|Set text to "Stop"

                        -     -->System|Set isMoving to 1

              [SubEvent](else)     System|isMoving = 1 --> Button|Set text to "Start"

                             -->System|Set isMoving to 0

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
313 26,509
Juryiel's avatar
Juryiel
Unread hot topic
57 16,731
Blinx123's avatar
Blinx123
Unread hot topic
53 16,569
Ashley's avatar
Ashley Construct Team Founder