home *** CD-ROM | disk | FTP | other *** search
/ GQ - Louise, World Cup, …remy Clarkson, Armageddon / GQCD.iso / files / featbio.dxr / 00018_textScrollScript.ls < prev    next >
Encoding:
Text File  |  1998-05-21  |  1.8 KB  |  65 lines

  1. property textSprite, myScrollDelay, minSafeArea, maxSafeArea, topLimit, bottomLimit, activeLeft, activeRight
  2. global gMasterObj
  3.  
  4. on new me
  5.   return me
  6. end
  7.  
  8. on init me, whichTextSprite, scrollDelay, safeTop, safeBottom, tLimit, bLimit
  9.   set textSprite to whichTextSprite
  10.   set myScrollDelay to scrollDelay
  11.   set minSafeArea to safeTop
  12.   set maxSafeArea to safeBottom
  13.   set topLimit to tLimit
  14.   set bottomLimit to bLimit
  15.   set activeLeft to the left of sprite textSprite
  16.   set activeRight to the right of sprite textSprite
  17.   puppetSprite(textSprite, 1)
  18.   append(the actorList, me)
  19. end
  20.  
  21. on stepFrame me
  22.   if (the mouseH > activeLeft) and (the mouseH < activeRight) then
  23.     if the mouseV > maxSafeArea then
  24.       setCursorExemption(gMasterObj, 1)
  25.       set myDirection to (the mouseV - (maxSafeArea - 10)) / myScrollDelay
  26.       scrollUp(me, myDirection)
  27.     else
  28.       if the mouseV < minSafeArea then
  29.         setCursorExemption(gMasterObj, 1)
  30.         set myDirection to (the mouseV - (minSafeArea + 10)) / myScrollDelay
  31.         scrollDown(me, myDirection)
  32.       else
  33.         setCursorExemption(gMasterObj, 0)
  34.         cursor(-1)
  35.       end if
  36.     end if
  37.   else
  38.     setCursorExemption(gMasterObj, 0)
  39.   end if
  40. end
  41.  
  42. on scrollUp me, myDirection
  43.   set newPos to the locV of sprite textSprite - myDirection
  44.   if newPos < topLimit then
  45.     cursor([7, 8])
  46.     set the locV of sprite textSprite to topLimit
  47.   else
  48.     cursor([3, 4])
  49.     set the locV of sprite textSprite to newPos
  50.   end if
  51.   put myDirection
  52. end
  53.  
  54. on scrollDown me, myDirection
  55.   set newPos to the locV of sprite textSprite - myDirection
  56.   if newPos > bottomLimit then
  57.     cursor([5, 6])
  58.     set the locV of sprite textSprite to bottomLimit
  59.   else
  60.     cursor([1, 2])
  61.     set the locV of sprite textSprite to newPos
  62.   end if
  63.   put myDirection
  64. end
  65.