on getPropertyDescriptionList
set description = [:]
set directionDef = #Horizontal
if the currentspritenum = 1 then
alert "this behavior will not work on sprite channels below 2"
exit
else
set backDef = max(1,the currentspritenum - 1)
set backList = []
repeat with i = 1 to backDef
if the memberNum of sprite i > 0 then add backList,i
end repeat
if count(backList) > 0 then
set backDef = getLast(backList)
else set backList = [1]
set cursorList = [#none]
repeat with i = 1 to the number of members
if the type of member i = #bitmap then
if the depth of member i = 1 then
if the name of member i <> "" then
add cursorList, the name of member i
else add cursorList, member i
end if
end if
end repeat
set cursDef = #none
end if
on beginSprite me
if the memberNum of sprite backSprite = 0 then
alert "Behaviour 'Marks Slider' on sprite" && the spriteNum of me & ":" & return & return & "You need a background sprite in a lower channel number for this behaviour to work properly."
exit
end if
case direction of
#horizontal:
set tempMargin = (the width of sprite (the spriteNum of me)) / 2
set tempMargin2 = (the width of sprite (the spriteNum of me)) - tempMargin
set lowBorder = tempMargin2 + margin + the left of sprite backSprite
set highBorder = - tempMargin - margin + the right of sprite backSprite
#vertical:
set tempMargin = (the height of sprite (the spriteNum of me)) / 2
set tempMargin2 = (the height of sprite (the spriteNum of me)) - tempMargin
set lowBorder = tempMargin + margin + the top of sprite backSprite
set highBorder = - tempMargin2 - margin + the bottom of sprite backSprite
end case
set range = highBorder - lowBorder
set scale = float(abs(maximum - minimum)) / float(range)
set lok = 0
set start = 0
set currentValue = minimum
if numberFormat = #integer then
showValue me, integer(currentValue)
else
showValue me, currentValue
end if
if not voidP(cursorMember) and cursorMember <> #none then setCursor me, true
return me
end
on mouseDown me
case direction of
#horizontal:
set lok = the locH of sprite (the SpriteNum of me)
set start = the mouseH
#vertical:
set lok = the locV of sprite (the SpriteNum of me)
set start = the mouseV
end case
end mouseDown
on prepareFrame me
if lok > 0 then
case direction of
#horizontal:
set hor = the mouseH
set screenVal = max(lowBorder,min(lok + hor - start,highBorder))
set the locH of sprite (the spriteNum of me) to screenVal
if Update = #continuous then doUpdate me, screenVal - lowBorder
#vertical:
set ver = the mouseV
set screenVal = max(lowBorder,min(lok + ver - start,highBorder))
set the locV of sprite (the spriteNum of me) to screenVal
if Update = #continuous then doUpdate me, highBorder - screenVal
end case
end if
end exitFrame
on mouseUpOutside me
endUpdate me
end mouseUpOutside
on mouseup me
endUpdate me
end mouseup
on endUpdate me
set lok = 0
set start = 0
case direction of
#horizontal:
doUpdate me, the locH of sprite (the spriteNum of me) - lowBorder
#vertical:
doUpdate me, highBorder - the locV of sprite (the spriteNum of me)
end case
end endUpdate
on doUpdate me, scrvalue
if minimum < maximum then
set currentValue = minimum + scrvalue * scale
else set currentValue = minimum - scrValue * scale
if numberFormat = #integer then set currentValue = integer(currentValue)
showValue me, currentValue
if handlerName <> "" then do handlerName && currentValue
end
on showValue me, theVal
if minimum < maximum then
set scrValue = (theVal - minimum) / scale
case direction of
#horizontal:
set the locH of sprite (the SpriteNum of me) to lowBorder + scrValue
#vertical:
set the locV of sprite (the SpriteNum of me) to highBorder - scrValue
end case
else
set scrValue = (theVal - maximum) / scale
case direction of
#horizontal:
set the locH of sprite (the SpriteNum of me) to highBorder - scrValue
#vertical:
set the locV of sprite (the SpriteNum of me) to lowBorder + scrValue
end case
end if
end showValue
on setCursor me, theVal
if theVal then
set theCurs = the number of member cursorMember
set theMask = the number of member(the name of member cursorMember & ".mask")
if theMask > 0 then
set the cursor of sprite (the spriteNum of me) = list(theCurs, theMask)
else set the cursor of sprite (the spriteNum of me) = list(theCurs)
else set the cursor of sprite (the spriteNum of me) = 0
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA