Jonathan, I would also recommend using the var name prefixes as recommended by LC in thier Tips for Writing Good Code when sharing publicly. Like this I mean:
Local sStartDrag Local sAllowDrag Local sStartDragMil Local sCumulativeMomentum on mousedown focus on nothing if word 1 of the name of the target = "button" or the isbutton of the target = 1 then exit mousedown end if put (the mouseV)+(the vScroll of me) into sAllowDrag put the milliseconds into sStartDragMil put (the mouseV) into sStartDrag repeat with CM = 1 to 5 put 0 into sCumulativeMomentum[CM] end repeat send momentumAccumulate to me in 0 milliseconds end mousedown on momentumAccumulate local tTimeForLastMove, tCurrentMouseV, tLastDistanceCovered if mouse(1) <> "down" then exit momentumAccumulate end if put the milliseconds-sStartDragMil into tTimeForLastMove put (the mouseV) into tCurrentMouseV put tCurrentMouseV - sStartDrag into tLastDistanceCovered if tTimeForLastMove = 0 then put 1 into tTimeForLastMove end if repeat with CM = 5 down to 2 put sCumulativeMomentum[CM-1] into sCumulativeMomentum[CM] end repeat put (tLastDistanceCovered*10) / tTimeForLastMove into sCumulativeMomentum[1] put tCurrentMouseV into sStartDrag put the milliseconds into sStartDragMil send momentumAccumulate to me in 5 milliseconds end momentumAccumulate on mousemove if sAllowDrag <> empty then set the vScroll of me to sAllowDrag-(the mouseV) end if end mousemove on mouseup local tCMTotal, tAverageMomentum, tRemainingDistance put empty into sAllowDrag put 0 into tCMTotal Repeat with CM = 1 to 5 add sCumulativeMomentum[CM] to tCMTotal end Repeat put tCMTotal/5 into tAverageMomentum put tAverageMomentum * 30 into tRemainingDistance doMomentumScrolling tRemainingDistance,50 end mouseup on doMomentumScrolling pRemainingDistance, pCount local tDistanceToMove if pCount > 50 then exit doMomentumScrolling end if if mouse(1) is "down" then exit doMomentumScrolling end if put pRemainingDistance/15 into tDistanceToMove put the vScroll of me into tVScroll set the vScroll of me to tVScroll - tDistanceToMove put pRemainingDistance-tDistanceToMove into pRemainingDistance put pCount-1 into pCount send "doMomentumScrolling pRemainingDistance, pCount" to me in 5 milliseconds end doMomentumScrolling I hope this doesn't come across as patronising. You've obviously got some years of skill behind you and I don't want to come across as demeaning. Sean Cole *Pi Digital Productions Ltd* eMail Ts & Cs <http://pidigital.co.uk/emailTCs.rtf> Pi Digital Productions Ltd is a UK registered limited company, no. 5255609 _______________________________________________ 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