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

  1. on indexButton 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 down 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 up buttonList
  28.   global gLastIndexButton
  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(gLastIndexButton) then
  34.       unSelect(gLastIndexButton)
  35.     end if
  36.     set gLastIndexButton to buttonList
  37.     return 1
  38.   else
  39.     return 0
  40.   end if
  41. end
  42.  
  43. on select buttonList
  44.   global gLastIndexButton
  45.   set gLastIndexButton to EMPTY
  46.   down(buttonList)
  47.   up(buttonList)
  48. end
  49.  
  50. on unSelect 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.