Make a group of sprites act like radio buttons only with mouseDown and rollover effects
on getBehaviorDescription me
return "BUTTON BEHAVIOR WITH ROLLOVER"&RETURN&RETURN&"Make a group of sprites act like radio buttons only with mouseDown and rollover effects."&RETURN&RETURN&"PARAMETERS:"&RETURN&"* MouseDown Cast Member"&RETURN&"* Rollover Cast Member"&RETURN&"* Selected Cast Member"&RETURN&"* Name of Button Group"&RETURN&"* First Sprite in Group"&RETURN&"* Last Sprite in Group"
end
on getBehaviorTooltip me
return "Use with graphic sprites."&RETURN&RETURN&"Make a group of sprites act like radio buttons only with mouseDown and rollover effects."
end getBehaviorTooltip
-- HISTORY --
-- March 2000
-- Written for the Pinnacle Interactive Behaviors Palette by Scott Marion
-- Based on the Rollover Change Member behavior written for the D7 Behaviors Palette by James Newton
-- this behavior is based on the Rollover Change Member in the behavior library
-- this behavior makes a group of sprites act like radio buttons
-- the group of sprites need to be in consecutive channels
on beginSprite me
mySprite = sprite (me.spriteNum)
myStandardMember = mySprite.member
active = 0
end
on mouseEnter me
if the blend of sprite mysprite = 100 and not the selected of me then
if activeSprite = 0 then
mySprite.member = myRolloverMember
updateStage
else if mySprite = sprite(activeSprite) then
mySprite.member = myDownMember
updateStage
end if
end if
end mouseEnter
on mouseLeave me
if the blend of sprite mysprite = 100 and not the selected of me then
mySprite.member = myStandardMember
updateStage
end if
end mouseLeave
on mouseWithin me
if the blend of sprite mysprite = 100 and not the selected of me then
if activeSprite = 0 then
mySprite.member = myRolloverMember
updateStage
end if
end if
end mouseWithin
on mouseDown me
if the blend of sprite mysprite = 100 and not the selected of me then
set mySprite.member = myDownMember
set activeSprite = me.spriteNum
updateStage
sendallsprites(#piSelectButtonGroupMember_PropertySet_ActiveSprite, mygroup, me.spriteNum)
end if
end mouseDown
on mouseUp me
if the blend of sprite mysprite = 100 and not the selected of me then
if mySprite = sprite(activeSprite) then
sendAllSprites(#piSelectButtonGroupMember_Reset, myGroup)
set mySprite.member = mySelectedMember
updateStage
set activeSprite = 0
sendallsprites(#piSelectButtonGroupMember_PropertySet_ActiveSprite, mygroup, 0)
set the selected of me = true
end if
end if
end mouseDown
on mouseUpOutside me
if the blend of sprite mysprite = 100 and not the selected of me then
set mySprite.member = myStandardMember
updateStage
set activeSprite = 0
sendallsprites(#piSelectButtonGroupMember_PropertySet_ActiveSprite, mygroup, 0)
end if
end mouseUpOutside
on piSelectButtonGroupMember_PropertySet_ActiveSprite me, vGroup, vSpriteNum
if vGroup = myGroup then
activeSprite = vSpriteNum
end if
end
on piSelectButtonGroupMember_Reset me, vGroup
if vGroup = myGroup then
mySprite.member = myStandardMember
set the selected of me = false
end if
end
on getPropertyDescriptionList
if the currentSpriteNum = 0 then exit
theMember = sprite(the currentSpriteNum).member
theMemberNumber = theMember.number
return [#myDownMember: [#comment: "Display which member on mouseDown?", #format: #graphic, #default: member (theMemberNumber + 1)], #myRolloverMember: [#comment: "Display which member on rollover?", #format: #graphic, #default: member (theMemberNumber + 2)], #mySelectedMember: [#comment: "Display which member when selected?", #format: #graphic, #default: member (theMemberNumber + 3)],#myGroup: [ #comment: "Name of the radio button group?", #format: #string, #default: 1 ], #firstSprite: [#comment: "First sprite in radio button group?", #format: #integer, #default: 1 ], #lastSprite: [ #comment: "Last sprite in radio button group?", #format: #integer, #default: 2]]
end getPropertyDescriptionList
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA