property sNum
property shadowHeight
property halfShadHeight
property moveMode -- whether in up or down part of animation
property frameCount -- how much time left in this part of animation
property actionType, actionText -- what to do or where to go
property overMe
on getBehaviorDescription me
return "A simple button behavior that plays a drop shadow animation when the user clicks. The drop shadow shrinks over time. "
end
on getPropertyDescriptionList me
set list = [:]
addProp list, #shadowHeight, [#comment: "Shadow Height:", #format: #integer, #default: 5, #range: [#max: 25, #min:1]]
addProp list, #actionType, [#comment: "Action Type:", #format: #symbol, #range: [#goToFrame, #doLingo], #default: #doLingo]
addProp list, #actionText, [#comment: "Frame Name or Handle Name:", #format: #string, #default: "beep()"]
return list
end
on beginSprite me
set frameCount = VOID
set moveMode = VOID
set overMe = -1
set halfShadHeight = shadowHeight / 2
set sNum = the spriteNum of me
dropShadow(sprite sNum, [#animMode: #static, #xOffSet: shadowHeight, #yOffSet: shadowHeight])
end
on mouseDown me
set overMe = TRUE
dropShadow(sprite sNum, [#animMode: #range, #numFrames: 6, #endXOffSet: 0, #endYOffSet: 0])
repeat while the mouseDown
updateStage
if rollover(sNum) and overMe = FALSE then
dropShadow(sprite sNum, [#animMode: #range, #numFrames: 6, #endXOffSet: 0, #endYOffSet: 0])
set overMe = TRUE
else if (not rollover(sNum)) and (overMe = TRUE) then
dropShadow(sprite sNum, [#animMode: #range, #numFrames: 6, #endXOffSet: shadowHeight, #endYOffSet: shadowHeight])
set overMe = FALSE
end if
end repeat
if overMe then
dropShadow(sprite sNum, [#animMode: #range, #numFrames: 6, #endXOffSet: shadowHeight, #endYOffSet: shadowHeight])
repeat with x = 1 to 6
updateStage
end repeat
action(me)
end if
end
on action me
if actionType = #goToFrame then
-- IF YOU GET A LINGO ERROR HERE, THEN YOU HAVE MIS-ENTERED THE
-- FRAME NAME OR VALUE
if value(actionText) > 0 then
go to frame value(actionText) -- go to frame number
else
go to frame actionText -- go to frame label
end if
else if actionType = #doLingo then
-- IF YOU GET A LINGO ERROR HERE, THEN YOU HAVE MIS-ENTERED THE
-- HANDLER FOR THIS BEHAVIOR TO CALL
do actionText
end if
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA