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 startNextCode: Select all
on mouseUp
startNext
end mouseUpCode: Select all
global startNextT
on mouseup
cancel startNextT
end mouseupStop 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 startNextCode: Select all
on mouseUp
startNext
end mouseUpCode: Select all
global startNextT
on mouseup
cancel startNextT
end mouseupkeram