home *** CD-ROM | disk | FTP | other *** search
/ Comic Book Maker: The Smurfs / COMIC.iso / pc / data_w / dialog / 00043_soundAdjusterBhvr.ls < prev    next >
Encoding:
Text File  |  1999-07-07  |  1.3 KB  |  45 lines

  1. property mySprite, myMemb, maxRight, minLeft
  2.  
  3. on beginSprite me
  4.   set mySprite to the currentSpriteNum
  5.   set myMemb to the memberNum of sprite mySprite
  6.   set minLeft to the locH of sprite (mySprite - 1) - (the width of the member of sprite mySprite / 2)
  7.   set maxRight to minLeft + 128
  8.   set the locH of sprite mySprite to minLeft + (the volume of sound 1 / 2)
  9.   set the locH of sprite (mySprite + 1) to the locH of sprite mySprite
  10. end
  11.  
  12. on mouseEnter me
  13.   cursor(260)
  14. end
  15.  
  16. on mouseLeave me
  17.   cursor(-1)
  18. end
  19.  
  20. on mouseDown me, force
  21.   if not force then
  22.     cursor(290)
  23.     set offset to the locH of the clickLoc - the locH of sprite mySprite
  24.     set oldLoc to the locH of the clickLoc + offset
  25.     repeat while the mouseDown
  26.       set newLoc to min(maxRight, max(minLeft, the mouseH - offset))
  27.       if not (newLoc = oldLoc) then
  28.         set the locH of sprite mySprite to newLoc
  29.         set the locH of sprite (mySprite + 1) to the locH of sprite mySprite
  30.         updateStage()
  31.         set oldLoc to newLoc
  32.       end if
  33.     end repeat
  34.     set the volume of sound 1 to (the locH of sprite mySprite - minLeft) * 2
  35.   else
  36.     set the locH of sprite mySprite to minLeft + (the volume of sound 1 / 2)
  37.     set the locH of sprite (mySprite + 1) to the locH of sprite mySprite
  38.   end if
  39.   puppetSound(1, "testSnd")
  40.   updateStage()
  41.   if not force then
  42.     cursor(260)
  43.   end if
  44. end
  45.