Hi Andrea,
currently HTML5 does not yet support "wait" and does not a screen refresh in a repeat loop, even if you would explicitely lock screen/unlock screen.
Until this happens you can do what you wanted to do this way:
Code: Select all
local sCounter -- important to place it here so every handler in this script can access it
on mouseUp
put 0 into sCounter
send countUp to me in 10 milliseconds
end mouseUp
on CountUp
if sCounter >= 200 then
set the label of button "contatore" to 0
exit CountUp
end if
add 1 to sCounter
set the label of button "contatore" to sCounter
-- vary time here when next count increment should happen
send CountUp to me in 10 milliseconds
end CountUp
This uses "send in xx milliseconds" to handler CountUp and then the handler CountUp calls himself up to 200 in sCount.
sCount is a "script local variable" this means it is declared outside of any handler, usually at the top of the script. (see code). This has the advantage that any handler in this script (in this case of the button) and reade and write into this variable.
This works for HTML5 and for all other platforms. At times in HTML5 you have to play with the milliseconds if the script does not work as you expect. I tried this script with 3 milliseconds and it worked too. Other script might need 10 milliseconds.
If you have further questions feel free to ask.
Kind regards
Bernd