At 1:48 AM -0800 1/10/01, Jim Weekes wrote:
>Hello list,
>This is my first mail and i'm a bit of a lingo newbie but it's coming along
>quite quickly.
>Just asking whether anyone knows if it's possible to have two timers going
>at the same time in a movie i.e. a timer for the whole movie, and another
>timer elsewhere starting and being set to zero etc without effecting the
>main one.
>I've got a funny feeling its not possible but thought i'd check.
>
Well, the answer is no and yes. No, in the sense of the lingo "the
timer" ther can be only one.
However, if you "roll your own" in Lingo, you can have as many timers
as you wish. The basic idea is that you can set a variable (either a
global variable or a property variable within a behavior or an
object) to the current time (either "the milliseconds" or "the
ticks"), then whenever you want to update it, you can find the
elapsed time by subracting the current time minus the original time.
For example:
global gTimer1
global gTimer2
on startMovie
gTimer1 = the milliseconds
gTimer2 = the milliseconds
end
on GetTimer1
millisecondsElapsed = the milliseconds - gTimer1
return millisecondsElapsed
end
on GetTimer2
millisecondsElapsed = the milliseconds - gTimer2
return millisecondsElapsed
end
on ResetTimer2
gTimer2 = the milliseconds -- reset the base time to the current time
end
Good luck,
Irv
--
Lingo / Director / Shockwave development for all occasions.
(Over two millions lines of Lingo code served!)
[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!]