Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
ROLLOVER FADES
Installer
File Save Button
Director 7 Demystified
Print Formatted and HTML Text Using a Browser
Rollover Shift Hue-Alphamania
Bevel Drag Light-Alphamania
Link Email
simODBCPro Xtra
CatEffects pack
 

 

 

Behavior Custom Radio/Check Box

Added on 11/12/1999

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

Rating:

Author: MediaMacros (website)

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. :-)

property spriteNum, group, onAtStart, checked, unchecked, hilite

on getPropertyDescriptionList me
  p_list = [:]
  p_list.addProp(#group, [#format : #integer, #comment : "Which group:", #default : 1])  
  p_list.addProp(#onAtStart, [#format : #boolean, #comment : "Checked at start?:", #default : 0])
  p_list.addProp(#unchecked, [#format : #member, #comment : "Unchecked Member:", #default : sprite(the currentSpriteNum).member])
  p_list.addProp(#checked, [#format : #member, #comment : "Checked Member:", #default : member(sprite(the currentSpriteNum).member.number + 1)])
  return p_list
end

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

Send e-mail