home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
cyber.net 2
/
cybernet2.ISO
/
dkdemo
/
rev.dir
/
00039_Script_39
< prev
next >
Wrap
Text File
|
1995-04-04
|
4KB
|
100 lines
on moveSlider scrollSprite,Tbutn,TSNum,topCovr,textHt
global maxSteps,stepCounter,txtLocV,theTop,theBot
--òò trackSprite No = TSnum , thumb button = Tbtn , text = scrollSprite
--òò topcovr = cast defining top of window,textHt = leading
setUpGlobals scrollSprite,Tbutn,TSNum,topCovr,textHt
repeat while the stilldown
set the locv of sprite Tbutn to the mouseV
if the mouseV < theTop then
set the locv of sprite Tbutn to theTop
end if
if the mouseV > theBot then
set the locv of sprite Tbutn to theBot
end if
updatestage
put setTextSpriteLoc(Tbutn,TSNum,textHt) into stepCounter
set the locv of sprite scrollSprite to txtLocV -textHt* stepCounter
updatestage
end repeat
end
on setTextSpriteLoc Tbutn,TSNum,textH
global maxSteps,stepCounter,theTop,theBot,theRange,totScroll,Steps
--òò force floating point presion on maths functions
put the locv of sprite Tbutn - the top of sprite TSNum - (the height of sprite value(Tbutn))/2 into y1
put y1*1.00/theRange into y3
-- òò y3 now holds the fraction traversed
put integer(maxSteps*y3) into y6
return y6
end
on scrollIt UpORdown,downCast,scrollSprite,Tbutn,TSNum,topCovr,textHt
--òò use line by line scrolling based on txtHeight = 18 normally
global maxSteps,stepCounter,txtLocV,theTop,theBot
put the clickOn into me
set upCastNum to the castNum of sprite me
set the castNum of sprite me to downCast
updateStage
put the height of sprite scrollSprite into theHT
setUpGlobals scrollSprite,Tbutn,TSNum,topCovr,textHt
repeat while the stilldown
put the locv of sprite scrollSprite into yPos
--òò increment
if UpORDown = "up" then
put stepCounter - 1 into stepCounter
if stepCounter < 0 then
put 0 into stepCounter
end if
else if UpORDown = "down" then
put stepCounter + 1 into stepCounter
if stepCounter > maxSteps then
put maxSteps into stepCounter
end if
end if
set the locv of sprite scrollSprite to txtLocV -textHt* stepCounter
updatestage
put setBtnSpriteLoc(stepCounter,TSNum,Tbutn) into theVloc
set the locV of sprite Tbutn to theVloc
updatestage
end repeat
set the castNum of sprite me to upCastNum
updatestage
end
on setUpGlobals scrollSprite,Tbutn,TSNum,topCovr,textHt
global maxSteps,theTop,theBot,theRange,totScroll,Steps
put the height of sprite value(scrollSprite) into totScroll
--òò deduct the height of the display area approx = ht of trackSprite - overlap with sprite topCovr at the top of the scrolling window
--put the height of sprite value( TSNum ) - (the bottom of sprite topCovr - the top of sprite value( TSNum )) into dispHt
put the height of sprite value( TSNum ) + 2*(the bottom of sprite topCovr - the top of sprite value( TSNum )) into dispHt
put totScroll - dispHt into totScroll
put totScroll/textHt into maxSteps
put (the height of sprite value(Tbutn))/2 into HBtnHt
put the top of sprite value(TSnum) into TStop
put the bottom of sprite value(TSnum) into TSbot
put TStop + HBtnHt + 1 into theTop
put TSbot - HBtnHt into theBot
put the height of sprite value(TSnum) - 2*HBtnHt into theRange
end
on setBtnSpriteLoc stepCounter,TSNum,Tbutn
global maxSteps,theTop,theBot,theRange,totScroll,Steps
--òò work out percentage of scroll bar traversed
--òò force floating point presion on maths functions
put stepCounter*1.00/maxSteps into y3
--òò y3 now holds the fraction traversed
put integer (y3 * theRange) into y5
put the top of sprite TSNum + y5 + (the height of sprite value(Tbutn))/2 into y6
return y6
end