home *** CD-ROM | disk | FTP | other *** search
/ The Dynamic Human Version 2.0 / DH2_CD2.ISO / pc / files / bookmark.dxr / 00024_buttonObject.ls < prev    next >
Encoding:
Text File  |  1998-11-13  |  2.7 KB  |  88 lines

  1. property dynamicSprite, regionList, active
  2.  
  3. on new me, dSprite, rList
  4.   set dynamicSprite to dSprite
  5.   set regionList to duplicate(rList)
  6.   set active to 1
  7.   set the visible of sprite dynamicSprite to 0
  8.   puppetSprite(dynamicSprite, 1)
  9.   updateStage()
  10.   return me
  11. end
  12.  
  13. on death me
  14.   puppetSprite(dynamicSprite, 0)
  15.   set the visible of sprite dynamicSprite to 1
  16.   updateStage()
  17. end
  18.  
  19. on updateButton me
  20.   global gButUpdated, gAudioWindow, gquitWindow
  21.   set currH to the mouseH
  22.   set currV to the mouseV
  23.   if objectp(gAudioWindow) then
  24.     return 
  25.   end if
  26.   if objectp(gquitWindow) then
  27.     return 
  28.   end if
  29.   if active then
  30.     set inRegion to 0
  31.     repeat with i = 1 to count(regionList)
  32.       set regionRect to getAt(getAt(regionList, i), 1)
  33.       if (currH > getAt(regionRect, 1)) and (currH < getAt(regionRect, 3)) and (currV > getAt(regionRect, 2)) and (currV < getAt(regionRect, 4)) then
  34.         set the locH of sprite dynamicSprite to getAt(getAt(getAt(regionList, i), 2), 1)
  35.         set the locV of sprite dynamicSprite to getAt(getAt(getAt(regionList, i), 2), 2)
  36.         if the mouseDown then
  37.           set the memberNum of sprite dynamicSprite to getAt(getAt(regionList, i), 4)
  38.         else
  39.           set the memberNum of sprite dynamicSprite to getAt(getAt(regionList, i), 3)
  40.         end if
  41.         set the visible of sprite dynamicSprite to 1
  42.         set gButUpdated to 1
  43.         set inRegion to 1
  44.         exit repeat
  45.       end if
  46.     end repeat
  47.     if inRegion = 0 then
  48.       set the visible of sprite dynamicSprite to 0
  49.     end if
  50.   else
  51.     set the visible of sprite dynamicSprite to 0
  52.   end if
  53. end
  54.  
  55. on buttonMouseUp me
  56.   global gButMovie, gButFrame, gButRegionLists, gButCalled
  57.   set currH to the mouseH
  58.   set currV to the mouseV
  59.   if active then
  60.     if voidp(gButCalled) then
  61.       set gButCalled to 0
  62.     end if
  63.     if gButCalled = 1 then
  64.       return 
  65.     end if
  66.     set inRegion to 0
  67.     repeat with i = 1 to count(regionList)
  68.       set regionRect to getAt(getAt(regionList, i), 1)
  69.       if (currH > getAt(regionRect, 1)) and (currH < getAt(regionRect, 3)) and (currV > getAt(regionRect, 2)) and (currV < getAt(regionRect, 4)) then
  70.         updateStage()
  71.         set the locH of sprite dynamicSprite to getAt(getAt(getAt(regionList, i), 2), 1)
  72.         set the locV of sprite dynamicSprite to getAt(getAt(getAt(regionList, i), 2), 2)
  73.         set the memberNum of sprite dynamicSprite to getAt(getAt(regionList, i), 3)
  74.         set the visible of sprite dynamicSprite to 1
  75.         set gButCalled to 1
  76.         do(getAt(getAt(regionList, i), 5))
  77.         set inRegion to 1
  78.         exit repeat
  79.       end if
  80.     end repeat
  81.     if inRegion = 0 then
  82.       set the visible of sprite dynamicSprite to 0
  83.     end if
  84.   else
  85.     set the visible of sprite dynamicSprite to 0
  86.   end if
  87. end
  88.