You are switching the layers instead of using show and hide.

I added a quit button to stop the animation.

I tried this with both 16 milliseconds and 8 milliseconds.
(I think 8 might be slightly better.)  I still see some flicker
though, even when I turn off the development tools.
If it were fast enough I would just observe a solid purple
rectangle.

When I tried it as a standalone on a Mac it was even worse.
What’s up with that!  One would think it should be more
efficient not less.

Your thoughts?

Rick



> On Mar 23, 2019, at 5:31 PM, Niggemann, Bernd via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> Hi Rick,
> 
> rename your red and blue  graphic according to this script or change the 
> names in this script and try this. It works quite well for me.
> 
> 
> -------------------------------------------
> local sRed = "255,0,0"
> local sBlue = "17,137,255"
> local sRunning = false
> 
> on mouseUp
>   if not sRunning then
>      put true into sRunning
>      set the backgroundColor of grc "gRed" to sRed
>      set the backgroundColor of grc "gBlue" to sBlue
>      goRun
>   else
>      put false into sRunning
>   end if
> end mouseUp
> 
> on goRun
>   if not sRunning then exit goRun
>   if "goRun" is among the lines of the pendingMessages then exit goRun
>   lock screen -- pushes screen refresh after handler
>   if the layer of grc "gRed" > the layer of grc "gBlue" then 
>      set the layer of grc "gBlue" to top
>   else
>      set the layer of grc "gRed" to top
>   end if
>   send "goRun" to me in 16 milliseconds
> end goRun
> -------------------------------------------
> 
> Kind regards
> Bernd
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to