home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 January / Chip_1997-01_cd.bin / dirwin / data.z / ANIMWIZ.DIR / 00003_Script_CheckBox < prev    next >
Text File  |  1996-03-15  |  1KB  |  58 lines

  1. -- CheckBox script
  2.  
  3. property ichCheckBox
  4. property iCurrentValue
  5.  
  6. on birth me
  7.   return me
  8. end birth
  9.  
  10. on mInit me, chCheckBox, defaultValue
  11.   set ichCheckBox = chCheckBox
  12.   puppetSprite ichCheckBox, TRUE
  13.   if voidP(defaultValue) then
  14.     set iCurrentValue = TRUE
  15.   else
  16.     set iCurrentValue = defaultValue
  17.   end if
  18.   mDraw(me)
  19. end mInit
  20.  
  21.  
  22.  
  23. on mDraw me
  24.   global gCastNumCheckBoxOn
  25.   global gCastNumCheckBoxOff
  26.   
  27.   if iCurrentValue then
  28.     set the castnum of sprite ichCheckBox = gCastNumCheckBoxOn
  29.   else
  30.     set the castnum of sprite ichCheckBox = gCastNumCheckBoxOff    
  31.   end if
  32.   updateStage
  33. end mDraw
  34.  
  35.  
  36.  
  37. on mHit me
  38.   set iCurrentValue = not(iCurrentValue)
  39.   mDraw(me)
  40. end mHit
  41.  
  42. on mGetValue me
  43.   return iCurrentValue
  44. end mGetValue
  45.  
  46. on mSetValue me, theNewValue
  47.   if (theNewValue <> TRUE) and (theNewValue <> FALSE) then
  48.     alert("Bad value passed to mSetValue of CheckBox:"  && theNewValue)
  49.     return
  50.   end if
  51.   set iCurrentValue = theNewValue
  52.   mDraw(me)
  53. end mSetValue
  54.  
  55. on mCleanUp me
  56.   puppetSprite ichCheckBox, FALSE
  57. end mCleanup
  58.