home *** CD-ROM | disk | FTP | other *** search
/ Maclife 12 / MACLIFE12-No-92-1996.ISO.7z / MACLIFE12-No-92.ISO / CD-ROM MACLIFE12 / NEWS AREA / Sampler V1.2 / TWTW / sell.dir / 00039.ls < prev    next >
Encoding:
Text File  |  1996-02-15  |  2.9 KB  |  81 lines

  1. on moveSlider scrollSprite, Tbutn, TSNum, topCovr, textHt
  2.   global maxSteps, stepCounter, txtLocV, theTop, theBot
  3.   setUpGlobals(scrollSprite, Tbutn, TSNum, topCovr, textHt)
  4.   repeat while the stillDown
  5.     set the locV of sprite Tbutn to the mouseV
  6.     if the mouseV < theTop then
  7.       set the locV of sprite Tbutn to theTop
  8.     end if
  9.     if the mouseV > theBot then
  10.       set the locV of sprite Tbutn to theBot
  11.     end if
  12.     updateStage()
  13.     set stepCounter to setTextSpriteLoc(Tbutn, TSNum, textHt)
  14.     set the locV of sprite scrollSprite to txtLocV - (textHt * stepCounter)
  15.     updateStage()
  16.   end repeat
  17. end
  18.  
  19. on setTextSpriteLoc Tbutn, TSNum, textH
  20.   global maxSteps, stepCounter, theTop, theBot, theRange, totScroll, Steps
  21.   set y1 to the locV of sprite Tbutn - the top of sprite TSNum - (the height of sprite value(Tbutn) / 2)
  22.   set y3 to y1 * 1.0 / theRange
  23.   set y6 to integer(maxSteps * y3)
  24.   return y6
  25. end
  26.  
  27. on scrollIt UpORDown, downCast, scrollSprite, Tbutn, TSNum, topCovr, textHt
  28.   global maxSteps, stepCounter, txtLocV, theTop, theBot
  29.   set me to the clickOn
  30.   set upCastNum to the castNum of sprite me
  31.   set the castNum of sprite me to downCast
  32.   updateStage()
  33.   set theHT to the height of sprite scrollSprite
  34.   setUpGlobals(scrollSprite, Tbutn, TSNum, topCovr, textHt)
  35.   repeat while the stillDown
  36.     set yPos to the locV of sprite scrollSprite
  37.     if UpORDown = "up" then
  38.       set stepCounter to stepCounter - 1
  39.       if stepCounter < 0 then
  40.         set stepCounter to 0
  41.       end if
  42.     else
  43.       if UpORDown = "down" then
  44.         set stepCounter to stepCounter + 1
  45.         if stepCounter > maxSteps then
  46.           set stepCounter to maxSteps
  47.         end if
  48.       end if
  49.     end if
  50.     set the locV of sprite scrollSprite to txtLocV - (textHt * stepCounter)
  51.     updateStage()
  52.     set theVloc to setBtnSpriteLoc(stepCounter, TSNum, Tbutn)
  53.     set the locV of sprite Tbutn to theVloc
  54.     updateStage()
  55.   end repeat
  56.   set the castNum of sprite me to upCastNum
  57.   updateStage()
  58. end
  59.  
  60. on setUpGlobals scrollSprite, Tbutn, TSNum, topCovr, textHt
  61.   global maxSteps, theTop, theBot, theRange, totScroll, Steps
  62.   set totScroll to the height of sprite value(scrollSprite)
  63.   set dispHt to the height of sprite value(TSNum) + (2 * (the bottom of sprite topCovr - the top of sprite value(TSNum)))
  64.   set totScroll to totScroll - dispHt
  65.   set maxSteps to totScroll / textHt
  66.   set HBtnHt to the height of sprite value(Tbutn) / 2
  67.   set TStop to the top of sprite value(TSNum)
  68.   set TSbot to the bottom of sprite value(TSNum)
  69.   set theTop to TStop + HBtnHt + 1
  70.   set theBot to TSbot - HBtnHt
  71.   set theRange to the height of sprite value(TSNum) - (2 * HBtnHt)
  72. end
  73.  
  74. on setBtnSpriteLoc stepCounter, TSNum, Tbutn
  75.   global maxSteps, theTop, theBot, theRange, totScroll, Steps
  76.   set y3 to stepCounter * 1.0 / maxSteps
  77.   set y5 to integer(y3 * theRange)
  78.   set y6 to the top of sprite TSNum + y5 + (the height of sprite value(Tbutn) / 2)
  79.   return y6
  80. end
  81.