home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Encyklopedia Omnia
/
Planeta.iso
/
data
/
m_info.dir
/
00008_Script_TextThumbScroll
< prev
next >
Wrap
Text File
|
2000-10-16
|
4KB
|
101 lines
property minVloc, maxVloc, NStesto, upArrowSN, downArrowSN, totalTextHeight,¼
spaceFromArrows, thumbMinY, thumbMaxY, thumbX, thumbName, pagina
on beginSprite
set upArrowSN = (the currentSpriteNum) - 1
set downArrowSN = (the currentSpriteNum) + 1
set thumbName = the name of member the member of sprite NStesto
initSprite
end
on initSprite
set alto = the bottom of sprite (NStesto+1)
set basso = the top of sprite (NStesto+2)
set pagina = basso - alto
set totalTextHeight = the PageHeight of member the member of sprite NStesto
-- per le freccie
set maxVloc = the locV of sprite NStesto
set minVloc = pagina + maxVloc - the pageHeight of member the member of sprite NStesto
if minVloc > maxVloc then
set minVloc = maxVloc
set the cursor of sprite (the currentSpriteNum) to 0
else
set the cursor of sprite (the currentSpriteNum) to [member "palmo", member "palmo_m"]
end if
-- per il thumb
set upDisplace = getAt(the regPoint of member the member of sprite the currentSpriteNum,2)
set downDisplace = (the height of sprite the currentSpriteNum) - upDisplace
set thumbMinY = (the bottom of sprite upArrowSN) + upDisplace + spaceFromArrows
set thumbMaxY = (the top of sprite downArrowSN) - downDisplace - spaceFromArrows
set thumbX = the locH of sprite the currentSpriteNum
set the loc of sprite the currentSpriteNum to point(thumbX,thumbMinY)
end
on arrowScroll me, pNewVloc
if minVloc <> maxVloc then
set newVloc = pNewVloc
if newVloc < minVloc then set newVloc to minVloc
if newVloc > maxVloc then set newVloc to maxVloc
set the locV of sprite NStesto to newVloc
-- traccia lo scroll sul thumb
set scrollExtent = thumbMaxY - thumbMinY
set currentScrollTop = maxVloc - newVloc
set diff = totalTextHeight - pagina
if diff <> 0 then
set newY = thumbMinY + scrollExtent*(currentScrollTop/float(diff))
-- sposta il thumb
set the loc of sprite the currentSpriteNum to point(thumbX, newY)
end if
updateStage
end if
end
on mouseDown
if minVloc <> maxVloc then
-- settings iniziali
set ns = the currentSpriteNum
set the cursor of sprite (ns) to [member "pugno", member "pugno_m"]
set totalTextHeight = the PageHeight of member the member of sprite NStesto
set scrollExtent = thumbMaxY - thumbMinY
set oldY = the locV of sprite ns
set offset = getAt(the clickLoc, 2) - the locV of sprite ns
-- loop sul mouseDown
repeat while the mousedown
set newY = mouseV() - offset
if newY > thumbMaxY then set newY = thumbMaxY
if newY < thumbMinY then set newY = thumbMinY
-- se necessario...
if newY <> oldY then
-- sposta il thumb
set the loc of sprite ns to point(thumbX, newY)
set oldY = newY
-- e scrolla il testo
set newScrollTop = (totalTextHeight - pagina) * ((newY - thumbMinY)/float(scrollExtent))
set newTxtY = maxVloc - newScrollTop
set the locV of sprite NStesto to newTxtY
end if
updateStage
end repeat
set the cursor of sprite (ns) to [member "palmo", member "palmo_m"]
end if
end
on getPropertyDescriptionList
set p_list = [#NStesto: [#comment:"Numero sprite testo:",¼
#format: #integer, #default: 1],¼
#spaceFromArrows: [#comment:"Spaziatura tra freccie e thumb:",¼
#format: #integer, #default: 2]]
return p_list
end