Synchronous scrolling Solved

Scott Rossi scott at tactilemedia.com
Fri May 15 18:05:25 EDT 2009


Recently, DunbarX at aol.com wrote:

> My fault. I had, for three (measly) fields:
> 
> on scrollBarDrag
>    set the scroll of fld "F1" to the scroll of me --me is F3
>    set the scroll of fld "F2" to the scroll of me
> end scrollBarDrag
> 
> You have (essentially):
> 
> on scrollBarDrag
>    repeat with y = 1 to 3
>      set the scroll of fld y to the scroll of me --me is F3
>    end repeat
> end scrollBarDrag

Here's a performance hint: when updating control settings/values/positions,
use variables when possible, rather than polling the objects' properties.
This goes for scrollbar dragging, which is why the demo is written:

on scrollbarDrag N
   repeat with F = 1 to 3
      set scroll of fld F to N
   end repeat
end scrollbarDrag

N (the scroll value in pixels) is automatically provided by the
scrollbarDrag handler, so for best performance, you should use this, rather
than repeatedly polling the scroll of the scrollbar itself as you're doing
above.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design





More information about the use-livecode mailing list