Click on the same button multiple times

A timer component is showing pictures on the screen whenever it is fired from a list of pictures, and an increment of 1 “global Picture_Appear” is done whenever the picture appears:

and when you click a Button “Press” whenever the image appeared twice it compares the increment “global Picture_Appear” and does an increment of 1 if it is true, if it is false nothing happens :

The problem is the button is only working once whenever it is clicked for the first if loop the other loops nothing is happening no increment whenever I click the button. How can I make the button when it is clicked to check for each loop and does any increment whenever it is true? Thanks.

All blocks:

can you explain again what should happen, if the user clicks the button “Press”?
Taifun

1 Like

Every time i “Press” Button is clicked, if loop should check each condition and if it is true the procedure is evaluated but the problem is that. If i click the “Press” Button once, the first loop is evaluated but the other loops are not evaluated whenever i click the “Press” Button again even though the condition is true. Thanks

sorry, I still do not get it… don’t explain your code, just explain what should happen for the user…
you might want to use Do it to debug your blocks, see tip 4 here App Inventor: How to Learn | Pura Vida Apps

Taifun

1 Like

Thanks, I will try to explain very well if i still do not manage to work on the problem.

What you might wanna do is have a variable, so that every time the button is clicked, the variable increments by +1, eventually reset it at a certain number to 0. Basically, just check what the button variable is at every time the button is clicked, and run that specific procedure according to how many times the button was clicked.

1 Like

That is what i basically did, whenever i clicked on the button the first increment +1 will be done with the specific procedure but the rest were not giving any output or increment. Thanks @hammerhai

1 Like