More send in time

Scott Rossi scott at tactilemedia.com
Tue Jul 1 02:33:00 EDT 2003


Recently, Ken Norris wrote:

> I took the basic premise I started from, then sliced off bits and pieces of
> the posted scripts, reassembled them, refactored and hopefully reduced it.
> 
> What I came up with is this base to work from. It works great and seems very
> stable. It's a scrolling field with upper and lower sections covered by
> translucent graphics and an open box across the center (where the eventual
> selection will take place). It has a few repeated lines at the head and tail
> such that it smooth-scrolls endlessly in either direction.

> on mouseDown
> endlessScroller
> end mouseDown
> 
> on endlessScroller
> constant scrollSpeedInterval = 10 -- will be a global later
> if the mouse is up then exit endlessScroller
> if within(graphic "upScrollArea", mouseLoc()) then
> -- wrapover:
> if the vScroll of fld 1 = 0 then set the vScroll of fld 1 to 1345
> set the vScroll of fld 1 to (the vScroll of fld 1) - 1
> else if within(graphic "downScrollArea", mouseLoc()) then
> -- wrapover:
> if the vScroll of fld 1 „ 1345 then set the vScroll of fld 1 to 0
> set the vScroll of fld 1 to (the vScroll of fld 1) + 1
> end if
> send "endlessScroller" to me in scrollSpeedInterval milliseconds
> end endlessScroller

You would do well to modify the above script to be more in keeping with the
examples provided because eventually you may find your script fails, ie
sticks in one direction or another (you are continually polling the mouse
state).

on mouseDown
   set the uAllowScroll of me to true
   endlessScroller
end mouseDown

on endlessScroller
   constant scrollSpeedInterval = 10 -- will be a global later
   if not the uAllowScroll of me then exit endlessScroller
   if within(graphic "upScrollArea", mouseLoc()) then
     -- wrapover:
     if the vScroll of fld 1 = 0 then set the vScroll of fld 1 to 1345
     set the vScroll of fld 1 to (the vScroll of fld 1) - 1
   else if within(graphic "downScrollArea", mouseLoc()) then
     -- wrapover:
     if the vScroll of fld 1 „ 1345 then set the vScroll of fld 1 to 0
     set the vScroll of fld 1 to (the vScroll of fld 1) + 1
   end if
   send "endlessScroller" to me in scrollSpeedInterval milliseconds
end endlessScroller

on mouseUp
   set the uAllowScroll of me to false
end mouseUp

on mouseRelease
   mouseUp
end mouseRelease



Regards,

Scott Rossi
Creative Director

Tactile Media, Multimedia & Design
Email: scott at tactilemedia.com
Web: www.tactilemedia.com




More information about the use-livecode mailing list