home *** CD-ROM | disk | FTP | other *** search
/ Organic Chemistry (8th Edition) / Image.iso / pc / data1.cab / Program_Files / PC_IR_Tutor / INTERP06 / 00002.ls next >
Encoding:
Text File  |  2003-05-14  |  5.1 KB  |  225 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 6 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.       go("Leave")
  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, 0)
  100.   installMenu(4)
  101.   set the checkMark of menuItem 6 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, 0)
  116.   installMenu(3)
  117.   set the checkMark of menuItem 6 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 < 29) or (posH > 629) then
  128.     exit
  129.   end if
  130.   if expRegion = 0 then
  131.     set prefix to EMPTY
  132.     if posH < 221 then
  133.       set waveNum to 4000 - ((posH - 29) * 2000 / 192)
  134.     else
  135.       set waveNum to 2000 - ((posH - 221) * 1600 / 408)
  136.     end if
  137.   else
  138.     if expRegion = 1 then
  139.       set prefix to "Exp1 "
  140.       set waveNum to 3200 - ((posH - 44) * 600 / 571)
  141.     else
  142.       if expRegion = 2 then
  143.         set prefix to "Exp2 "
  144.         set waveNum to 5000
  145.       else
  146.         set prefix to "Exp3 "
  147.         set waveNum to 1700 - ((posH - 44) * 700 / 570)
  148.       end if
  149.     end if
  150.   end if
  151.   if (waveNum < 3094) and (waveNum > 3021) then
  152.     go(prefix & "Arom H Str")
  153.   end if
  154.   if (waveNum < 2940) and (waveNum > 2903) then
  155.     go(prefix & "CH3 Anti Str")
  156.   end if
  157.   if (waveNum < 2903) and (waveNum > 2854) then
  158.     go(prefix & "CH3 Sym Str")
  159.   end if
  160.   if (waveNum < 1965) and (waveNum > 1719) then
  161.     go(prefix & "Overtone")
  162.   end if
  163.   if (waveNum < 1616) and (waveNum > 1594) then
  164.     go(prefix & "Ring Str A")
  165.   end if
  166.   if (waveNum < 1500) and (waveNum > 1487) then
  167.     go(prefix & "Ring Str B")
  168.   end if
  169.   if (waveNum < 1475) and (waveNum > 1461) then
  170.     go(prefix & "CH3 Asym Bend")
  171.   end if
  172.   if (waveNum < 1461) and (waveNum > 1444) then
  173.     go(prefix & "Ring Str C")
  174.   end if
  175.   if (waveNum < 1387) and (waveNum > 1374) then
  176.     go(prefix & "CH3 Umbr")
  177.   end if
  178.   if (waveNum < 1220) and (waveNum > 797) then
  179.     go(prefix & "Finger")
  180.   end if
  181.   if (waveNum < 750) and (waveNum > 722) then
  182.     go(prefix & "OOP H Bend")
  183.   end if
  184.   if (waveNum < 710) and (waveNum > 691) then
  185.     go(prefix & "OOP Ring Bend")
  186.   end if
  187.   if (waveNum < 600) and (waveNum > 455) then
  188.     go(prefix & "Finger")
  189.   end if
  190. end
  191.  
  192. on doOverlay whichCast
  193.   global expRegion, useKeys
  194.   if useKeys < 3 then
  195.     exit
  196.   end if
  197.   set dummy to whichCast + expRegion
  198.   if (whichCast = 0) or (the castNum of sprite 8 = dummy) then
  199.     set the castNum of sprite 8 to 0
  200.   else
  201.     set the castNum of sprite 8 to whichCast + expRegion
  202.   end if
  203.   puppetTransition(1, 2, 10, 0)
  204. end
  205.  
  206. on setUseKeys theCode
  207.   global useKeys
  208.   set useKeys to theCode
  209. end
  210.  
  211. on dontLeave
  212.   global auxframePos, useKeys, auxoldUseKeys
  213.   set useKeys to auxoldUseKeys
  214.   go(auxframePos)
  215. end
  216.  
  217. on doLeave
  218.   global frameName, movieName
  219.   when keyDown then nothing
  220.   set the puppet of sprite 8 to 0
  221.   installMenu(0)
  222.   updateStage()
  223.   go(frameName, movieName)
  224. end
  225.