home *** CD-ROM | disk | FTP | other *** search
/ Better Homes & Gardens: …oking for Today - Chicken / Image.iso / pc / main.dxr / 00004_indexButton.ls < prev    next >
Encoding:
Text File  |  1995-11-20  |  1.3 KB  |  55 lines

  1. on radioButton spriteNum
  2.   puppetSprite(spriteNum, 1)
  3.   set buttonList to []
  4.   set myCast to the castNum of sprite spriteNum
  5.   set pressedCast to myCast + 1
  6.   add(buttonList, spriteNum)
  7.   add(buttonList, myCast)
  8.   add(buttonList, pressedCast)
  9.   return buttonList
  10. end
  11.  
  12. on radioDown buttonList
  13.   set mySprite to getAt(buttonList, 1)
  14.   set myCast to getAt(buttonList, 2)
  15.   set pressedCast to getAt(buttonList, 3)
  16.   set the castNum of sprite mySprite to pressedCast
  17.   repeat while the mouseDown
  18.     if rollOver(mySprite) then
  19.       set the castNum of sprite mySprite to pressedCast
  20.     else
  21.       set the castNum of sprite mySprite to myCast
  22.     end if
  23.     updateStage()
  24.   end repeat
  25. end
  26.  
  27. on radioUp buttonList
  28.   global gLastRadioButton
  29.   set mySprite to getAt(buttonList, 1)
  30.   set myCast to getAt(buttonList, 2)
  31.   set pressedCast to getAt(buttonList, 3)
  32.   if the castNum of sprite mySprite = pressedCast then
  33.     if objectp(gLastRadioButton) then
  34.       unSelect(gLastRadioButton)
  35.     end if
  36.     set gLastRadioButton to buttonList
  37.     return 1
  38.   else
  39.     return 0
  40.   end if
  41. end
  42.  
  43. on radioSelect buttonList
  44.   global gLastRadioButton
  45.   set gLastRadioButton to EMPTY
  46.   radioDown(buttonList)
  47.   radioUp(buttonList)
  48. end
  49.  
  50. on radioUnselect buttonList
  51.   set mySprite to getAt(buttonList, 1)
  52.   set myCast to getAt(buttonList, 2)
  53.   set the castNum of sprite mySprite to myCast
  54. end
  55.