home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / pc / tutorial / devglry / bigtop / shockwav / 27_pollu.dcr / 00036_slider.ls < prev    next >
Encoding:
Text File  |  1996-04-10  |  993 b   |  33 lines

  1. on mouseDown
  2.   global curFrame, scoreData, frameCounterSpr
  3.   set sliderSpr to the clickOn
  4.   set shuttleSpr to sliderSpr - 1
  5.   set hOrg to the locH of sprite shuttleSpr
  6.   set range to float(the width of sprite shuttleSpr)
  7.   set nbFrames to count(scoreData)
  8.   if nbFrames < 1 then
  9.     set nbFrames to 1
  10.   end if
  11.   puppetSprite(sliderSpr, 1)
  12.   set step to range / nbFrames
  13.   repeat while the mouseDown
  14.     set dist to constrainH(shuttleSpr, the mouseH) - hOrg
  15.     set curFrame to integer(dist / step)
  16.     if curFrame < 1 then
  17.       set curFrame to 1
  18.     end if
  19.     set hPos to hOrg + dist
  20.     set the locH of sprite sliderSpr to hPos
  21.     set the locH of sprite frameCounterSpr to hPos - 15
  22.     put string(curFrame) into field "frameCounter"
  23.     updateStage()
  24.     displayFrame(curFrame, 0)
  25.   end repeat
  26.   if nbFrames <= 1 then
  27.     set the locH of sprite sliderSpr to hOrg
  28.     set the locH of sprite frameCounterSpr to hOrg - 15
  29.     put "1" into field "frameCounter"
  30.     updateStage()
  31.   end if
  32. end
  33.