home *** CD-ROM | disk | FTP | other *** search
/ Organic Chemistry (8th Edition) / Image.iso / pc / data1.cab / Program_Files / PC_IR_Tutor / INTERP09 / 00002.ls next >
Encoding:
Text File  |  2003-05-14  |  5.0 KB  |  221 lines

  1. on InitMenu
  2.   global leftArrow, rightArrow, retnKey, useKeys, expRegion
  3.   set leftArrow to 123
  4.   set rightArrow to 124
  5.   set retnKey to 36
  6.   installMenu(3)
  7.   set the checkMark of menuItem 9 of menu "Spectra" to 1
  8.   set the puppet of sprite 8 to 1
  9.   set the castNum of sprite 8 to 0
  10.   set the foreColor of sprite 8 to 243
  11.   set expRegion to 0
  12.   when keyDown then checkKey
  13. end
  14.  
  15. on checkKey
  16.   global leftArrow, rightArrow, retnKey, useKeys
  17.   if useKeys = 1 then
  18.     if the keyCode = retnKey then
  19.       doLeave()
  20.     else
  21.       exit
  22.       dontPassEvent()
  23.     end if
  24.   end if
  25.   if useKeys = 2 then
  26.     if the keyCode = retnKey then
  27.       when keyDown then nothing
  28.       set the puppet of sprite 8 to 0
  29.       installMenu(0)
  30.       quit()
  31.     else
  32.       exit
  33.       dontPassEvent()
  34.     end if
  35.   end if
  36.   if (the keyCode = leftArrow) and (useKeys <> 3) then
  37.     go(marker(-1))
  38.   else
  39.     if (the keyCode = rightArrow) and (useKeys <> 4) then
  40.       go(marker(1))
  41.     end if
  42.   end if
  43.   dontPassEvent()
  44. end
  45.  
  46. on checkButton
  47.   global useKeys
  48.   set posH to the mouseH
  49.   set posV to the mouseV
  50.   if (posV > 465) or (posV < 440) or (posH > 605) or (posH < 262) then
  51.     exit
  52.   end if
  53.   if (posH > 579) and (useKeys <> 4) then
  54.     go(marker(1))
  55.   end if
  56.   if (posH > 534) and (posH < 560) and (useKeys <> 3) then
  57.     go(marker(-1))
  58.   end if
  59.   if (posH > 459) and (posH < 500) then
  60.     doExit(0, "Quit")
  61.     exit
  62.   end if
  63.   if (posH > 384) and (posH < 425) then
  64.     doExit(0, "Help")
  65.     exit
  66.   end if
  67.   if posH < 350 then
  68.     doExit(1, "MainProg")
  69.     exit
  70.   end if
  71. end
  72.  
  73. on doExit whichFrame, whichMovie
  74.   global auxframePos, frameName, movieName, useKeys, auxoldUseKeys, expRegion
  75.   if useKeys < 3 then
  76.     exit
  77.   end if
  78.   set auxframePos to the frame
  79.   set auxoldUseKeys to useKeys
  80.   if whichFrame = 0 then
  81.     go(whichMovie & expRegion)
  82.     exit
  83.   else
  84.     go(1, whichMovie)
  85.   end if
  86. end
  87.  
  88. on doExpand whichOne
  89.   global framePos, useKeys, oldUseKeys, expRegion
  90.   if useKeys < 3 then
  91.     exit
  92.   end if
  93.   if the castNum of sprite 8 <> 0 then
  94.     set the castNum of sprite 8 to the castNum of sprite 8 + whichOne
  95.   end if
  96.   set expRegion to whichOne
  97.   set framePos to the frame
  98.   set oldUseKeys to useKeys
  99.   puppetTransition(5, 2, 10, 1)
  100.   installMenu(4)
  101.   set the checkMark of menuItem 9 of menu "Spectra" to 1
  102.   go("Exp" & expRegion)
  103. end
  104.  
  105. on doContract
  106.   global framePos, useKeys, oldUseKeys, expRegion
  107.   if useKeys < 3 then
  108.     exit
  109.   end if
  110.   if the castNum of sprite 5 <> 0 then
  111.     set the castNum of sprite 8 to the castNum of sprite 8 - expRegion
  112.   end if
  113.   set expRegion to 0
  114.   set useKeys to oldUseKeys
  115.   puppetTransition(6, 2, 10, 1)
  116.   installMenu(3)
  117.   set the checkMark of menuItem 9 of menu "Spectra" to 1
  118.   go(framePos)
  119. end
  120.  
  121. on doPeakClick
  122.   global expRegion, useKeys
  123.   set posH to the mouseH
  124.   if useKeys < 3 then
  125.     exit
  126.   end if
  127.   if (posH < 26) or (posH > 624) then
  128.     exit
  129.   end if
  130.   if expRegion = 0 then
  131.     set prefix to EMPTY
  132.     if posH < 224 then
  133.       set waveNum to 4000 - ((posH - 26) * 2000 / 199)
  134.     else
  135.       set waveNum to 2000 - ((posH - 224) * 1600 / 400)
  136.     end if
  137.   else
  138.     set prefix to "Exp1 "
  139.     set waveNum to 3200 - ((posH - 44) * 600 / 571)
  140.   end if
  141.   if (waveNum < 3490) and (waveNum > 3350) then
  142.     go(prefix & "Ovtn")
  143.   end if
  144.   if (waveNum < 2986) and (waveNum > 2941) then
  145.     go(prefix & "CH3 Anti Str")
  146.   end if
  147.   if (waveNum < 2942) and (waveNum > 2891) then
  148.     go(prefix & "CH2 Anti Str")
  149.   end if
  150.   if (waveNum < 2892) and (waveNum > 2872) then
  151.     go(prefix & "CH3 Sym Str")
  152.   end if
  153.   if (waveNum < 2873) and (waveNum > 2846) then
  154.     go(prefix & "CH2 Sym Str")
  155.   end if
  156.   if (waveNum < 2847) and (waveNum > 2772) then
  157.     go(prefix & "CHO H Str A")
  158.   end if
  159.   if (waveNum < 2773) and (waveNum > 2693) then
  160.     go(prefix & "CHO H Str B")
  161.   end if
  162.   if (waveNum < 1792) and (waveNum > 1659) then
  163.     go(prefix & "C=O Str")
  164.   end if
  165.   if (waveNum < 1476) and (waveNum > 1455) then
  166.     go(prefix & "CH3 Asym Bend")
  167.   end if
  168.   if (waveNum < 1456) and (waveNum > 1431) then
  169.     go(prefix & "CH2 Scis")
  170.   end if
  171.   if (waveNum < 1432) and (waveNum > 1403) then
  172.     go(prefix & "CH2 Scis Shift")
  173.   end if
  174.   if (waveNum < 1404) and (waveNum > 1383) then
  175.     go(prefix & "CHO H Bend")
  176.   end if
  177.   if (waveNum < 1384) and (waveNum > 1364) then
  178.     go(prefix & "CH3 Umbr")
  179.   end if
  180.   if (waveNum < 1300) and (waveNum > 744) then
  181.     go(prefix & "Finger")
  182.   end if
  183.   if (waveNum < 744) and (waveNum > 704) then
  184.     go(prefix & "CH2 Wag")
  185.   end if
  186. end
  187.  
  188. on doOverlay whichCast
  189.   global expRegion, useKeys
  190.   if useKeys < 3 then
  191.     exit
  192.   end if
  193.   set dummy to whichCast + expRegion
  194.   if (whichCast = 0) or (the castNum of sprite 8 = dummy) then
  195.     set the castNum of sprite 8 to 0
  196.   else
  197.     set the castNum of sprite 8 to whichCast + expRegion
  198.   end if
  199.   puppetTransition(1, 2, 10, 0)
  200. end
  201.  
  202. on setUseKeys theCode
  203.   global useKeys
  204.   set useKeys to theCode
  205. end
  206.  
  207. on dontLeave
  208.   global auxframePos, useKeys, auxoldUseKeys
  209.   set useKeys to auxoldUseKeys
  210.   go(auxframePos)
  211. end
  212.  
  213. on doLeave
  214.   global frameName, movieName
  215.   when keyDown then nothing
  216.   set the puppet of sprite 8 to 0
  217.   installMenu(0)
  218.   updateStage()
  219.   go(frameName, movieName)
  220. end
  221.