Use this behavior with your own graphics to create custom radio button groups or check boxes. Allows query of the hilite property just like regular Director radio buttons and check boxes.
--Copyright 1999 Chuck Neal
--chuck@mediamacros.com
--If you find this code helpful, send me an e-mail and let me know. :-)
on whoIsOn me, whatGroup, whatList
if whatGroup = group and hilite = true then
whatList.add(spriteNum)
end if
end
on beginSprite me
if onAtStart = true then
hilite = true
sprite(spriteNum).member = checked
else
hilite = false
sprite(spriteNum).member = unchecked
end if
end
on mouseUp me
if hilite = false then
sendAllSprites(#toggleButtons, spriteNum, group)
else
hilite = false
sprite(spriteNum).member = unchecked
end if
end
on toggleButtons me, whatSprite, whatGroup
if whatGroup = group then
if whatSprite = spriteNum then
hilite = 1
sprite(spriteNum).member = checked
else
hilite = 0
sprite(spriteNum).member = unchecked
end if
end if
end
on getBehaviorDescription me
describe = "This behavior will allow 2 graphics to act as a check box or radio group. Drop the behavior on the graphic and assign the checked and unchecked members." & return
describe = describe & "This uses a property named hilite so that the state can be called the same for a custom check box as it would be for a standard one." & return
describe = describe & "For radio groups, assign all the buttons the same group number in the property dialog box."
return describe
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA