Pausing a simple animation

John J. Theobald mailjjt at bellsouth.net
Thu May 15 16:04:01 EDT 2003


Jim Biancolo wrote:

> Hi again folks,
> 
> I thought I had this, but I'm still stumped.  I thought if I had my 
> "play" button invoke a different handler using "send in 10 milliseconds" 
> then the "on mouseUp" event of the play button would end instantly (in 
> effect) and other buttons would be clickable while the animation was 
> running (including my "pause" button).  This does not seem to be the 
> case.  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
> 
> Unfortunately "pause" remains unclickable for the duration of 
> "animateTokens" so there's no chance for it to set the global "b_play" 
> to FALSE until after the animation is already done.
> 
> On the bright side, I no longer feel like I'm missing something 
> obvious.  :-)  Can anybody help?
> 
> Thanks!
> 
> Jim
> 
> At 08:01 PM 5/14/2003 -0400, Jim Biancolo wrote:
> 
>> [ Sorry if this is a duplicate post - I never saw my original post 
>> appear on the list, despite seeing lots of other stuff since. ]
>>
>> Hi folks,
>>
>> I have a simple animation that fires on mouseUp of a "Play" button:
>>
>>   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"
>>       move image i of group "tokens" to ...
>>     end repeat
>>     set the lockMoves to false
>>   end repeat
>>
>> I know I must be missing something obvious, but I can't figure out how 
>> to let a "pause" button interrupt this loop.  The "pause" button 
>> doesn't appear to be clickable until the "play" mouseUp finishes.
>>
>> Any suggestions would be appreciated!
>>
>> Thanks,
>>
>> Jim
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 

Have a closer look at the "move" command and the "with messages" argument.

John J. Theobald




More information about the use-livecode mailing list