dysfunctional scroll the loc script

Timothy Miller gandalf at doctorTimothyMiller.com
Tue Oct 9 20:08:02 EDT 2012


Hello,

I thought this would be easy. It isn't working right. Don't know what to do.

The script:

on mouseUp
   put "537,1" into locVar
   repeat with i = 1 to 650
      set the loc of field "foo" to locvar
      add 1 to item 2 of locVar
      wait 1 millisecs
   end repeat
end mouseUp

It works, but it takes a whole lot longer than 650 milliseconds for the loc of the field to scroll to the bottom -- more like ten seconds, and it does not scroll smoothly.

I tried this instead:

on mouseUp
   put "537,1" into locVar
   repeat with i = 1 to 216
      set the loc of field "foo" to locvar
      add 3 to item 2 of locVar
      wait 3 millisecs
   end repeat
end mouseUp

It's a little faster, but it still takes 3.3 seconds. A little smoother, but not much.

If I increment the loc in units of ten and set the wait to ten millisecs, it scrolls in a little less than a second, but it looks jerky and the scroll still stutters.

I tried various adjustments to the field properties and various ways of writing the script. For example, I tried eliminating locVar and incrementing item 2 of the loc itself. Nothing seemed very helpful.

If I remove the "wait x millisecs" the loc scrolls to the bottom instantly. Can't even see it move. Apparently "wait 1 millisec" waits a lot longer than 1 millisec and the length of the wait is inconsistent.

I thought it might be a graphics rendering problem. The text scrolls in front of a photo. Hiding the photo doesn't help at all.

This is on a MacBook with 2.4 GHZ Core 2 Duo and tons of physical RAM and OS 10.7.4. Should be fast enough.

Activity Monitor shows that CPU usage gets up to about 40% while the script is running.

Any thoughts our suggestions? Thanks in advance.

Tim



More information about the use-livecode mailing list