Simon Marshall wrote:
>Hi All,
>
>Apologies if this has come up recently, I checked the archives and can't
>find anything relevant.
>
>What I'm after: To have a QuickTime movie playing on stage with a countdown
>of the time remaining in HH:MM:SS
<snip>
Greetings Simon
here's a little object that does what you're trying to do. Initialize
as you would any object - into a variable named say myObject:
myObject = (script "timerScript").new()
To start the timer:
myObject.mDoTimer(#xStart)
To stop the timer and grab the time:
myTime = myObject.mDoTimer(#xStop)
myTime is a string in the form HH:MM:SS
-------------------------
property pTimer
on new me
return me
end
on mDoTimer me, whatToDo
case whatToDo of
#xStart: -->start timer
pTimer = the milliseconds
#xStop: -->stop timer
delT = integer(((the milliseconds) - pTimer) / 1000.)
xsHours = "0"
xsMins = "0"
xsSecs = "0"
xsFinTime = delT --> duration in ms
if (delT >= 3600) then --> have hours
xHours = (delT - (delT mod 3600)) / 3600
delT = delT - (xHours * 3600)
xsHours = string(xHours)
end if
if (xsHours.length < 2) then xsHours = "0" & xsHours
--
if (delT >= 60) then --> have minutes
xMins = (delT - (delT mod 60)) / 60
delT = delT - (xMins * 60)
xsMins = string(xMins)
end if
if (xsMins.length < 2) then xsMins = "0" & xsMins
--
xsSecs = string(delT) --> have seconds
if (xsSecs.length < 2) then xsSecs = "0" & xsSecs
-->xsFinTime = time as string (hh:mm:ss)
xsFinTime = xsHours & ":" & xsMins & ":" & xsSecs
return xsFinTime
otherwise:
alert("Unknown whatToDo :: " & whatToDo)
end case
end
-------------------------
hope this helps
Christopher Schmidt
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]