Pausing a simple animation

miscdas at boxfrog.com miscdas at boxfrog.com
Fri May 16 12:49:01 EDT 2003


jim Biancolo writes:
[snip]
 --- EXAMPLE ---
When I hit "play" this code runs: 


on mouseUp
  send animateTokens to card "myCanvas" in 10 milliseconds
end mouseUp 


This invokes the handler: 


on animateTokens
 global b_play
 put TRUE into b_play
 repeat for each line L in field "frames"
   set the lockMoves to true
   repeat with i = 1 to the number of images in group "tokens_group"
     move image i of group "tokens_group" to coords without waiting
   end repeat
   set the lockMoves to false
   if not b_play then break
 end repeat
end animateTokens
 --- /EXAMPLE --- 


=============
Mr Biancolo, 

Perhaps this work-around for a mouseDown on a HALT button can work for you. 
The HALT button doesn't need any script, so you can eliminate the global 
b_play. 

on animateTokens

 repeat for each line L in field "frames"
   set the lockMoves to true
   repeat with i = 1 to the number of images in group "tokens_group"
     move image i of group "tokens_group" to coords without waiting
   end repeat
   set the lockMoves to false
   if within(button "HALT", the mouseLoc) and (the mouse is down) then
      break
   end if
 end repeat
end animateTokens 


miscdas



More information about the use-livecode mailing list