home *** CD-ROM | disk | FTP | other *** search
- property bannerSprite, selectorSprite, myScrollDelay, minSafeArea, maxSafeArea, minOffset, maxOffset
- global gSelectedPicture, gMasterObj
-
- on new me
- append(the actorList, me)
- return me
- end
-
- on init me, whichBannerSprite, whichSelectorSprite, scrollDelay, safeArea
- set bannerSprite to whichBannerSprite
- set selectorSprite to whichSelectorSprite
- set myScrollDelay to scrollDelay
- set myOffset to safeArea / 2.0
- set minSafeArea to 321 - myOffset
- set maxSafeArea to 320 + myOffset
- set myOffset to (the width of sprite bannerSprite - 1280) / 2.0
- set minOffset to 0 - myOffset
- set maxOffset to 640 + myOffset
- puppetSprite(bannerSprite, 1)
- puppetSprite(selectorSprite, 1)
- end
-
- on stepFrame me
- set topArea to the top of sprite bannerSprite
- set bottomArea to the bottom of sprite bannerSprite
- if (the mouseV > topArea) and (the mouseV < bottomArea) then
- if the mouseH > maxSafeArea then
- setCursorExemption(gMasterObj, 1)
- set myDirection to (the mouseH - (maxSafeArea - 10)) / myScrollDelay
- scrollLeft(me, myDirection)
- cursor([5, 6])
- else
- if the mouseH < minSafeArea then
- setCursorExemption(gMasterObj, 1)
- set myDirection to (the mouseH - (minSafeArea + 10)) / myScrollDelay
- scrollRight(me, myDirection)
- cursor([3, 4])
- else
- setCursorExemption(gMasterObj, 1)
- cursor([1, 2])
- end if
- end if
- updateSelector(me)
- else
- removeSelector(me)
- end if
- end
-
- on updateSelector me
- repeat with i = -25 to 35
- set minValue to (39 * (i - 2)) + (the locH of sprite bannerSprite - 320) + 20
- set maxValue to (39 * (i - 1)) + (the locH of sprite bannerSprite - 320) + 21
- set myValue to (39 * (i - 1)) + (the locH of sprite bannerSprite - 320) + 1
- if (the mouseH > minValue) and (the mouseH < maxValue) then
- set the locH of sprite selectorSprite to myValue
- set gSelectedPicture to i + 11
- if gSelectedPicture > 23 then
- set gSelectedPicture to gSelectedPicture - 23
- end if
- put gSelectedPicture
- exit repeat
- end if
- end repeat
- end
-
- on removeSelector me
- if the locH of sprite selectorSprite <> -100 then
- set the locH of sprite selectorSprite to -100
- end if
- end
-
- on scrollLeft me, myDirection
- set newPos to the locH of sprite bannerSprite - myDirection
- if newPos < minOffset then
- set myRemainder to minOffset - newPos
- set the locH of sprite bannerSprite to maxOffset - myRemainder
- else
- set the locH of sprite bannerSprite to newPos
- end if
- end
-
- on scrollRight me, myDirection
- set newPos to the locH of sprite bannerSprite - myDirection
- if newPos > maxOffset then
- set myRemainder to newPos - maxOffset
- set the locH of sprite bannerSprite to minOffset + myRemainder
- else
- set the locH of sprite bannerSprite to newPos
- end if
- end
-