Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
DirectControl Xtra
Direct Email
Made with Macromedia and Shockwave Licensing Programs
Prime Number Xtra
Rotator 1.1
Animated Slider Puzzle by J.R.D.R.
ProjectorLook Xtra
Yes/No Dialog Box
KeyboardControl Xtra Lite
Gang Buster
MediaMacros Xtras Mall
 

 

 

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

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail