home *** CD-ROM | disk | FTP | other *** search
/ Better Homes & Gardens: …oking for Today - Chicken / Image.iso / pc / utility.dxr / 00003_radioButton.ls < prev    next >
Encoding:
Text File  |  1995-11-20  |  913 b   |  46 lines

  1. property mySprite, myCast, pressedCast
  2.  
  3. on birth me, spriteNum
  4.   set mySprite to spriteNum
  5.   puppetSprite(mySprite, 1)
  6.   set myCast to the castNum of sprite mySprite
  7.   set pressedCast to myCast + 1
  8.   return me
  9. end
  10.  
  11. on down me
  12.   set the castNum of sprite mySprite to pressedCast
  13.   repeat while the mouseDown
  14.     if rollOver(mySprite) then
  15.       set the castNum of sprite mySprite to pressedCast
  16.     else
  17.       set the castNum of sprite mySprite to myCast
  18.     end if
  19.     updateStage()
  20.   end repeat
  21. end
  22.  
  23. on up me
  24.   global gLastRadioButton
  25.   if the castNum of sprite mySprite = pressedCast then
  26.     if objectp(gLastRadioButton) then
  27.       unSelect(gLastRadioButton)
  28.     end if
  29.     set gLastRadioButton to me
  30.     return 1
  31.   else
  32.     return 0
  33.   end if
  34. end
  35.  
  36. on select me
  37.   global gLastRadioButton
  38.   set gLastRadioButton to EMPTY
  39.   down(me)
  40.   up(me)
  41. end
  42.  
  43. on unSelect me
  44.   set the castNum of sprite mySprite to myCast
  45. end
  46.