Page 1 of 1

Timeline Countdown

PostPosted: Fri Jan 27, 2012 8:18 am
by Alway
Is there a way to display the time left on the Timeline in a text box. I would like to let people know how long they have left on a particular slide so they know how long to wait. I could do this by putting in a timer and set it to the same time as the timeline but then I would also have to start and stop the timer with the play button. It just would seem cleaner if there was an onInterval event for the Timeline that could give that information.

Re: Timeline Countdown

PostPosted: Mon Jan 30, 2012 6:20 pm
by Nav
I actually think your first idea of using the Timer object would be much better. Yes, it will require another object and adding actions linking them (or adding responses to your existing actions to play/pause), but there's no way around that... You'd have to add a text object and add actions to update the text.

There is a "Get Current Time" method for the Timer object that is meant for other things, but we could use it here. The only tricky part is deciding a trigger. If you use Timeline > onCue, then you have to add a cue every second, which seems silly. But here's the action nonetheless:

Trigger: Timeline > onCue
Response: Text object > setText > function > Timeline > Get Current Time

But then this will only show you the time that has elapsed, so to really do this you'd need a variable, set it to the start time, and then subtract the current to time, to get the remaining time.

Trigger: Timeline > onCue
Response: Local Variables > Number > TimeRemaining > setValue = 90 [or whatever the variable is called, and whatever the time starts at]
Response: Local Variables > Number > TimeRemaining > subtract > function > Timeline > Get Current Time
Response: Text object > setText > function > Local Variables > Number > TimeRemaining > getValue

Much simpler to use a Timer.

- Nav

Not able to open ./cache/data_global.php