home *** CD-ROM | disk | FTP | other *** search
/ GameStar 1998 November (Bonus) / GAMESTAR11B.ISO / ENCYC99 / MM / T045067A.DCR / 00076_MovieScript.ls < prev    next >
Encoding:
Text File  |  1997-07-30  |  5.3 KB  |  213 lines

  1. global cSprites, stageWidth, stageHeight, progressBar, buttonTracker, LabelTracker, PopMenuButton, StopButton, PPButton, FFButton, RewButton, thisFrame, thatFrame, endFrame, playState, hasLabels, thisLine, thatLine, SoundTracker, ccTracker, inTransit
  2.  
  3. on startMovie
  4.   global doTransition
  5.   set the alertHook to new(script "theAlertHook")
  6.   initData()
  7.   set sendThis to "window size: [" & stageWidth & "], [" & stageHeight & "]"
  8.   externalevent(sendThis)
  9.   set doTransition to 0
  10.   set endFrame to the lastFrame
  11.   if the text of member "LabelField" = EMPTY then
  12.     set hasLabels to 0
  13.   else
  14.     set hasLabels to 1
  15.   end if
  16.   set cSprites to [:]
  17.   addProp(cSprites, #Background, 109)
  18.   addProp(cSprites, #PopMenuBox, 108)
  19.   puppetSprite(108, 1)
  20.   addProp(cSprites, #ProgBox, 110)
  21.   addProp(cSprites, #PopMenuBtn, 111)
  22.   puppetSprite(111, 1)
  23.   addProp(cSprites, #StopBtn, 112)
  24.   puppetSprite(112, 1)
  25.   addProp(cSprites, #PPBtn, 113)
  26.   puppetSprite(113, 1)
  27.   addProp(cSprites, #FFBtn, 114)
  28.   puppetSprite(114, 1)
  29.   addProp(cSprites, #RewBtn, 115)
  30.   puppetSprite(115, 1)
  31.   addProp(cSprites, #ProgBar, 117)
  32.   addProp(cSprites, #ProgHide, 119)
  33.   puppetSprite(119, 1)
  34.   addProp(cSprites, #ProgHandle, 120)
  35.   puppetSprite(120, 1)
  36.   initControls()
  37.   set playState to #paused
  38. end
  39.  
  40. on initControls
  41.   set ccTracker to new(script "ccTrackerMaker")
  42.   set SoundTracker to new(script "SoundTrackerMaker")
  43.   set progressBar to new(script "ProgressBarMaker", getProp(cSprites, #ProgHandle), getProp(cSprites, #ProgHide), getProp(cSprites, #ProgBar), "TransitionFrames")
  44.   set buttonTracker to new(script "ButtonTrackerMaker")
  45.   set LabelTracker to new(script "LabelTrackerMaker")
  46.   set StopButton to makeButton(buttonTracker, "Stop", #off, getProp(cSprites, #StopBtn))
  47.   set PPButton to makeButton(buttonTracker, "Play", #on, getProp(cSprites, #PPBtn))
  48.   set RewButton to makeButton(buttonTracker, "Rew", #on, getProp(cSprites, #RewBtn))
  49.   set FFButton to makeButton(buttonTracker, "FF", #on, getProp(cSprites, #FFBtn))
  50.   if hasLabels then
  51.     set PopMenuButton to makeButton(buttonTracker, "PopMenu", #on, getProp(cSprites, #PopMenuBtn))
  52.     set labelV to stageHeight - 17 - the pageHeight of member "LabelField"
  53.     set the locV of sprite 108 to labelV
  54.     set the visible of sprite 108 to 0
  55.   end if
  56. end
  57.  
  58. on idle
  59.   fakeMouseClicks()
  60.   if not (the stillDown) then
  61.     case thisFrame of
  62.       1:
  63.         turnOff(StopButton)
  64.         turnOff(RewButton)
  65.         turnON(PPButton)
  66.         turnON(FFButton)
  67.       endFrame:
  68.         turnON(StopButton)
  69.         turnON(RewButton)
  70.         turnOff(PPButton)
  71.         PPButtonPause()
  72.         turnOff(FFButton)
  73.       otherwise:
  74.         turnON(StopButton)
  75.         turnON(RewButton)
  76.         turnON(PPButton)
  77.         turnON(FFButton)
  78.     end case
  79.   end if
  80.   progTrack(progressBar, thisFrame)
  81.   mouseCheck(buttonTracker)
  82.   menuCheck()
  83.   ccCheck(ccTracker)
  84.   set thatFrame to thisFrame
  85. end
  86.  
  87. on enterFrame
  88.   set thisFrame to the frame
  89. end
  90.  
  91. on exitFrame
  92.   global doTransition
  93.   if doTransition <> 0 then
  94.     puppetTransition(member doTransition)
  95.     set doTransition to 0
  96.     set inTransit to 1
  97.   else
  98.     set inTransit to 0
  99.   end if
  100.   idle()
  101.   checkSound(SoundTracker, thisFrame)
  102. end
  103.  
  104. on PPButtonPause
  105.   if playState <> #paused then
  106.     pauseMovie(progressBar)
  107.     newButtonType(PPButton, "Play")
  108.     set playState to #paused
  109.   end if
  110. end
  111.  
  112. on PPButtonPlay
  113.   if playState <> #playing then
  114.     playMovie(progressBar)
  115.     newButtonType(PPButton, "Pause")
  116.     set playState to #playing
  117.   end if
  118. end
  119.  
  120. on stopButtonClick
  121.   stopTheMovie(progressBar)
  122.   PPButtonPause()
  123.   storePlaying(progressBar)
  124. end
  125.  
  126. on menuCheck
  127.   if the visible of sprite 108 then
  128.     set thisLine to the mouseLine
  129.     if thisLine <> thatLine then
  130.       if thisLine <> -1 then
  131.         set the foreColor of line thisLine of member "LabelField" to the foreColor of field "redField"
  132.       end if
  133.       if thatLine <> -1 then
  134.         set the foreColor of line thatLine of member "LabelField" to the foreColor of field "blackField"
  135.       end if
  136.     end if
  137.     set thatLine to thisLine
  138.     if (thisLine = -1) and the stillDown then
  139.       if not rollOver(108) then
  140.         if not rollOver(111) then
  141.           set the visible of sprite 108 to 0
  142.         end if
  143.       end if
  144.     end if
  145.   end if
  146. end
  147.  
  148. on animPause
  149.   if objectp(PPButton) then
  150.     PPButtonPause()
  151.     go(thisFrame)
  152.   end if
  153. end
  154.  
  155. on mouseDown
  156.   onMouseDown()
  157. end
  158.  
  159. on onMouseDown
  160.   storePlaying(progressBar)
  161.   externalevent("mouse click")
  162. end
  163.  
  164. on onMouseUp
  165.   resetPlaying(progressBar)
  166. end
  167.  
  168. on EvalScript xString
  169.   case xString of
  170.     "animPause":
  171.       do(xString)
  172.   end case
  173. end
  174.  
  175. on pt xString
  176.   EvalScript(xString)
  177. end
  178.  
  179. on fakeMouseClicks
  180.   global lastStillDown
  181.   set thisStillDown to the stillDown
  182.   if thisStillDown <> lastStillDown then
  183.     if not thisStillDown then
  184.       onMouseUp()
  185.     end if
  186.     set lastStillDown to thisStillDown
  187.   end if
  188. end
  189.  
  190. on keyDown
  191.   global keyList
  192.   set theKeyCode to the keyCode
  193.   if the controlDown then
  194.     if the optionDown then
  195.       case theKeyCode of
  196.         (the playKey of keyList):
  197.           case playState of
  198.             #playing:
  199.               PPButtonPause()
  200.             #paused:
  201.               PPButtonPlay()
  202.           end case
  203.         (the stopKey of keyList):
  204.           stopButtonClick()
  205.         (the ffKey of keyList):
  206.           nothing()
  207.         (the rewKey of keyList):
  208.           nothing()
  209.       end case
  210.     end if
  211.   end if
  212. end
  213.