home *** CD-ROM | disk | FTP | other *** search
- property myFieldName, iGrabBarTop, iGrabBarBottom, iWindowTop, iWindowBottom, iTextSprite, iBarSprite, searchRatio1, searchRatio2, iDefaultTextTopLoc, iDefaultTextBottomLoc
-
- on new me, fieldName, barTop, barBottom, textTop, textBottom, textSprite, barSprite
- iGrabBarTop = barTop
- iGrabBarBottom = barBottom
- iWindowTop = textTop
- iWindowBottom = textBottom
- iTextSprite = textSprite
- iBarSprite = barSprite
- iDefaultTextTopLoc = the locV of sprite iTextSprite
- iDefaultTextBottomLoc = the locV of sprite iTextSprite - (the bottom of sprite iTextSprite - iWindowBottom)
- testDistance = iWindowTop - iDefaultTextBottomLoc
- searchRatio1 = testDistance / float(iGrabBarBottom - iGrabBarTop)
- searchRatio2 = float(iGrabBarBottom - iGrabBarTop) / testDistance
- return me
- end
-
- on buttonScroll me, direction
- case direction of
- #up:
- if the top of sprite iTextSprite < iWindowTop then
- set the locV of sprite iTextSprite to the locV of sprite iTextSprite + 5
- else
- set the locV of sprite iTextSprite to iWindowTop
- end if
- #down:
- if the bottom of sprite iTextSprite > iWindowBottom then
- set the locV of sprite iTextSprite to the locV of sprite iTextSprite - 5
- else
- set the locV of sprite iTextSprite to iWindowBottom - (the bottom of sprite iTextSprite - the top of sprite iTextSprite)
- end if
- end case
- testLoc1 = iWindowTop - the locV of sprite iTextSprite
- testLoc2 = testLoc1 * searchRatio2
- newTextLoc = iGrabBarTop + testLoc2
- set the locV of sprite iBarSprite to newTextLoc
- end
-
- on grabScroll
- newLoc = the mouseV
- if newLoc <= iGrabBarTop then
- set the locV of sprite iBarSprite to iGrabBarTop
- set the locV of sprite iTextSprite to iDefaultTextTopLoc
- else
- if newLoc >= iGrabBarBottom then
- set the locV of sprite iBarSprite to iGrabBarBottom
- set the locV of sprite iTextSprite to iDefaultTextBottomLoc
- else
- set the locV of sprite iBarSprite to newLoc
- testLoc1 = newLoc - float(iGrabBarTop)
- testLoc2 = testLoc1 * searchRatio1
- newTextLoc = iWindowTop - testLoc2
- set the locV of sprite iTextSprite to newTextLoc
- end if
- end if
- updateStage()
- end
-
- on quickScroll me, locationOfClick
- testClick = locationOfClick - iGrabBarTop
- tempLocation = the locV of sprite iBarSprite - iGrabBarTop
- if testClick < tempLocation then
- newLoc = the locV of sprite iTextSprite + (iWindowBottom - iWindowTop - 20)
- if newLoc > iDefaultTextTopLoc then
- set the locV of sprite iTextSprite to iDefaultTextTopLoc
- else
- set the locV of sprite iTextSprite to newLoc
- end if
- else
- newLoc = the locV of sprite iTextSprite - (iWindowBottom - iWindowTop - 20)
- if newLoc < iDefaultTextBottomLoc then
- set the locV of sprite iTextSprite to iDefaultTextBottomLoc
- else
- set the locV of sprite iTextSprite to newLoc
- end if
- end if
- testLoc1 = iWindowTop - the locV of sprite iTextSprite
- testLoc2 = testLoc1 * searchRatio2
- newTextLoc = iGrabBarTop + testLoc2
- set the locV of sprite iBarSprite to newTextLoc
- updateStage()
- end
-