home *** CD-ROM | disk | FTP | other *** search
- property soundPlaying, currentList, currentListCount, currentIndex, timeZero, theEndTime
- global ccInfo, ccTrue, soundDurations
-
- on new me
- set soundPlaying to 0
- set the soundEnabled to 0
- return me
- end
-
- on ccOn me, xFrameSound
- if ccTrue then
- set timeZero to the ticks
- set currentList to getProp(ccInfo, xFrameSound)
- set currentListCount to count(currentList)
- set theEndTime to timeZero + getProp(soundDurations, xFrameSound)
- set currentIndex to 1
- set soundPlaying to 1
- end if
- end
-
- on ccOff me
- set soundPlaying to 0
- end
-
- on ccCheck me
- if ccTrue then
- if soundPlaying then
- set ticksPassed to the ticks - timeZero
- if ticksPassed > getPropAt(currentList, currentIndex) then
- set currentText to getAt(currentList, currentIndex)
- set currentIndex to currentIndex + 1
- if currentIndex > currentListCount then
- ccOff(me)
- end if
- displayCC(me, currentText)
- end if
- end if
- end if
- end
-
- on displayCC me, xInt
- set theString to line xInt - 1 of field "ccTextField"
- repeat while theString = EMPTY
- preloadMember("ccTextField")
- set theString to line xInt - 1 of field "ccTextField"
- end repeat
- set theNarrator to word 1 of theString
- delete word 1 of theString
- externalEvent("caption:[" & theNarrator & "][" & theString & "]")
- end
-
- on checkSoundBusy me
- if ccTrue then
- if the frameSound1 = 0 then
- return 0
- else
- return the ticks < theEndTime
- end if
- else
- return 0
- end if
- end
-