home *** CD-ROM | disk | FTP | other *** search
- property theSprite, theTop, theBottom, theMin, theMax, theValue, theCurLoc
-
- on new me, spr, t, b, min, max, value
- set theSprite to spr
- set theTop to t
- set theBottom to b
- set theMin to min
- set theMax to max
- set theValue to value
- set theCurLoc to ValueToV(me, value)
- return me
- end
-
- on Init me
- puppetSprite(theSprite, 1)
- set the locV of sprite theSprite to theCurLoc
- end
-
- on move me
- set theCurLoc to the mouseV
- if theCurLoc < theTop then
- set theCurLoc to theTop
- else
- if theCurLoc > theBottom then
- set theCurLoc to theBottom
- end if
- end if
- set the locV of sprite theSprite to theCurLoc
- end
-
- on EndMove me
- set theValue to VToValue(me, theCurLoc)
- end
-
- on VToValue me, v
- return theMax - integer(float(v - theTop) / (theBottom - theTop) * (theMax - theMin))
- end
-
- on ValueToV me, value
- return (float(theMax - value) / (theMax - theMin) * (theBottom - theTop)) + theTop
- end
-
- on Dispose me
- puppetSprite(theSprite, 0)
- end
-