I made 2 stacks to test the Stop button for repeat loop. In one case it's working OK, but in the second it does not. Why is it so?
Here is the code and attached stacks.
working OK:
stack script:
Code: Select all
global startNextT
on startNext
put empty into field "result"
repeat fld "reps" times
put "X" after fld "result"
wait 20 ticks
end repeat
send "startNext" to me in 120 ticks
put the result into startNextT
end startNext
Code: Select all
on mouseUp
startNext
end mouseUp
Code: Select all
global startNextT
on mouseup
cancel startNextT
end mouseup
Stop button not working:
stack script:
Code: Select all
global startNextT
on startNext
repeat with countVar = 1 to 20
put countVar +1 into fld "counter"
wait 20 ticks
end repeat
send "startNext" to me in 120 ticks
put the result into startNextT
end startNext
Code: Select all
on mouseUp
startNext
end mouseUp
Code: Select all
global startNextT
on mouseup
cancel startNextT
end mouseup
keram