home *** CD-ROM | disk | FTP | other *** search
/ Knitting Made Easy / Knitting.iso / App / Patterns.dxr / Text_123_textp12.ls < prev    next >
Encoding:
Text File  |  2002-04-18  |  1.4 KB  |  47 lines

  1. property pTextSprite, pTextMember, pTextLowerLImit, pTextRange, pLineSize, pPageSize, pTextOrigin
  2.  
  3. on beginSprite me
  4.   pLineSize = 13
  5.   totalLines = 15
  6.   pPageSize = totalLines * pLineSize
  7.   pTextOrigin = 29
  8.   pTextSprite = me.spriteNum
  9.   pTextMember = the member of sprite pTextSprite
  10.   lastOffset = integer(0.5 * totalLines) * pLineSize
  11.   textUpperLimit = member(pTextMember).height - lastOffset
  12.   pTextLowerLImit = 0
  13.   pTextRange = 2300
  14.   set the locV of sprite pTextSprite to pTextOrigin
  15. end
  16.  
  17. on scrollText me, direction, scrollType
  18.   case 1 of
  19.     voidp(scrollType):
  20.       scrollAmount = pLineSize
  21.     (scrollType = #page):
  22.       scrollAmount = pPageSize
  23.   end case
  24.   if symbolp(direction) then
  25.     case direction of
  26.       #down:
  27.         scrollDirection = 1
  28.       #up:
  29.         scrollDirection = -1
  30.     end case
  31.     scrollVector = scrollAmount * scrollDirection
  32.     currentPosition = pTextOrigin - the locV of sprite pTextSprite
  33.     nextPosition = currentPosition + scrollVector
  34.     if nextPosition > (pTextLowerLImit + pTextRange) then
  35.       nextPosition = pTextLowerLImit + pTextRange
  36.     else
  37.       if nextPosition < pTextLowerLImit then
  38.         nextPosition = pTextLowerLImit
  39.       end if
  40.     end if
  41.   else
  42.     nextPosition = direction * pTextRange
  43.   end if
  44.   set the locV of sprite pTextSprite to pTextOrigin - nextPosition
  45.   sendAllSprites(#positionIndicator, float(nextPosition) / pTextRange)
  46. end
  47.