home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 10 / MacAddict_010_1997_06.iso / media / ThisIssue.Dxr / Internal_1.ls < prev    next >
Encoding:
Text File  |  1997-03-25  |  5.2 KB  |  182 lines

  1. on startMovie
  2.   global DBfact, TBfact, gDb, gTB, gSoundLevel, gThumbPuppet, gBrowser
  3.   clearGlobals()
  4.   new(script "BrowserClass", "htmlsource")
  5.   openXLib(the pathName & "xtras:FileIOXtraFat")
  6.   set gOSDir to getOSDirectory()
  7.   put gOSDir & "Preferences:" into field "OSPath"
  8.   put gOSDir & "Preferences:Browser" into field "ThePath"
  9.   loadBrowser()
  10.   setVolumePos()
  11.   if the optionDown = 1 then
  12.     go("import")
  13.   end if
  14.   set the text of field "catsort" to "Free Stuff"
  15.   put the locH of sprite 18
  16.   put the locV of sprite 18
  17.   puppetSprite(20, 1)
  18.   set the moveableSprite of sprite 20 to 1
  19.   set the constraint of sprite 20 to 19
  20.   puppetSprite(22, 1)
  21.   set the moveableSprite of sprite 22 to 1
  22.   set the constraint of sprite 22 to 21
  23.   puppetSprite(23, 1)
  24. end
  25.  
  26. on resetThumb thumbname
  27.   puppetSprite(castspritea(thumbname), 1)
  28.   set the locV of sprite castspritea(thumbname) to 182
  29.   updateStage()
  30.   puppetSprite(castspritea(thumbname), 0)
  31. end
  32.  
  33. on scrollthumb minscroll, maxscroll, scrollfield, maxval
  34.   set spritenum to the clickOn
  35.   set thumb to the memberNum of sprite spritenum
  36.   puppetSprite(spritenum, 1)
  37.   updateStage()
  38.   set curv to the mouseV
  39.   set delta to curv - the locV of sprite spritenum
  40.   if stringp(scrollfield) then
  41.     set curlineheight to the textHeight of member scrollfield
  42.     set lineCount to the lineCount of member scrollfield
  43.     set totalheight to curlineheight * lineCount
  44.     set pageHeight to the pageHeight of member scrollfield
  45.     set remainder to totalheight - pageHeight + 1
  46.     if not voidp(maxval) then
  47.       set callback to replace(string(maxval), "'", QUOTE)
  48.       set callback to replace(callback, ";", RETURN)
  49.     else
  50.       set callback to #null
  51.     end if
  52.   else
  53.     if symbolp(scrollfield) then
  54.       set callback to replace(scrollfield, "'", QUOTE)
  55.       set callback to replace(callback, ";", RETURN)
  56.     end if
  57.   end if
  58.   repeat while the mouseDown
  59.     if totalheight <= pageHeight then
  60.       exit repeat
  61.     end if
  62.     set curv to min(max(the mouseV - delta, minscroll), maxscroll)
  63.     set target to (curv - minscroll) * remainder / (maxscroll - minscroll)
  64.     set the locV of sprite spritenum to curv
  65.     updateStage()
  66.     if stringp(scrollfield) then
  67.       set the scrollTop of member scrollfield to curlineheight * integer((curv - minscroll) * remainder / ((maxscroll - minscroll) * curlineheight))
  68.     end if
  69.     if callback <> #null then
  70.       do(callback && target)
  71.     end if
  72.   end repeat
  73.   set the memberNum of sprite spritenum to thumb
  74.   updateStage()
  75. end
  76.  
  77. on scroll direction, minscroll, maxscroll, scrollfield, thumbsymbol
  78.   set scrollfield to string(scrollfield)
  79.   set thumb to castspritea(string(thumbsymbol))
  80.   set curlineheight to the textHeight of member scrollfield
  81.   set lineCount to the lineCount of member scrollfield
  82.   set totalheight to curlineheight * lineCount
  83.   set pageHeight to the pageHeight of member scrollfield
  84.   set remainder to totalheight - pageHeight
  85.   if totalheight <= pageHeight then
  86.     exit
  87.   end if
  88.   repeat while the mouseDown
  89.     set oldpos to the scrollTop of member scrollfield
  90.     set pos to min(max(oldpos + (curlineheight * direction), 0), remainder)
  91.     set the scrollTop of member scrollfield to pos
  92.     set the locV of sprite thumb to minscroll + (pos * (maxscroll - minscroll) / remainder)
  93.     updateStage()
  94.     if not soundBusy(2) then
  95.       puppetSound(2, 0)
  96.       puppetSound(2, "Teletype A")
  97.     end if
  98.   end repeat
  99.   puppetSound(2, 0)
  100.   puppetSprite(thumb, 1)
  101. end
  102.  
  103. on replace basetext, oldtext, newtext
  104.   set buffer to EMPTY
  105.   set pos to offset(oldtext, basetext)
  106.   repeat while pos > 0
  107.     if pos > 1 then
  108.       set buffer to buffer & char 1 to pos - 1 of basetext & newtext
  109.       delete char 1 to pos + length(oldtext) - 1 of basetext
  110.     else
  111.       set buffer to buffer & newtext
  112.       delete char 1 to length(oldtext) of basetext
  113.     end if
  114.     set pos to offset(oldtext, basetext)
  115.   end repeat
  116.   set buffer to buffer & basetext
  117.   return buffer
  118. end
  119.  
  120. on squawkBox
  121.   set x to 0
  122.   set x to random(5)
  123.   set volSet to the volume of sound 1
  124.   set the volume of sound 1 to 40
  125.   puppetSound(1, 0)
  126.   puppetSound(1, "vox" & x)
  127.   repeat while soundBusy(1)
  128.     set the visible of sprite 3 to 1
  129.     updateStage()
  130.   end repeat
  131.   set the visible of sprite 3 to 0
  132.   set the volume of sound 1 to volSet
  133. end
  134.  
  135. on setVolumePos
  136.   case the soundLevel of
  137.     0:
  138.       set the locH of sprite 18 to 514
  139.     1:
  140.       set the locH of sprite 18 to 524
  141.     2:
  142.       set the locH of sprite 18 to 538
  143.     3:
  144.       set the locH of sprite 18 to 552
  145.     4:
  146.       set the locH of sprite 18 to 566
  147.     5:
  148.       set the locH of sprite 18 to 580
  149.     6:
  150.       set the locH of sprite 18 to 593
  151.     7:
  152.       set the locH of sprite 18 to 606
  153.   end case
  154. end
  155.  
  156. on setvolume
  157.   if the locH of sprite 18 <= 514 then
  158.     set the soundLevel to 0
  159.   end if
  160.   if the locH of sprite 18 > 514 then
  161.     set the soundLevel to 1
  162.   end if
  163.   if the locH of sprite 18 > 524 then
  164.     set the soundLevel to 2
  165.   end if
  166.   if the locH of sprite 18 > 538 then
  167.     set the soundLevel to 3
  168.   end if
  169.   if the locH of sprite 18 > 552 then
  170.     set the soundLevel to 4
  171.   end if
  172.   if the locH of sprite 18 > 566 then
  173.     set the soundLevel to 5
  174.   end if
  175.   if the locH of sprite 18 > 580 then
  176.     set the soundLevel to 6
  177.   end if
  178.   if the locH of sprite 18 > 593 then
  179.     set the soundLevel to 7
  180.   end if
  181. end
  182.