I'd like to make a couple of timer widgets triggered by any event. Count down and count up. can anyone guide me how to go about it please? And I am not looking for flash option - the target platform is iOS only.
Check out this prototype to see a count up timer. To change it to a countdown timer, alter the number of the countdown to be one digit greater than where you'd like the countdown to start (i.e. if you want the countdown to start at 10, change the number to 11).
Then, alter the last "On Variable Change" + "Set Value" action to be 'countdown - 1' instead of 'countdown + 1'
If you build an event with pause, setValue, pause, setValue.... you should be able to accomplish what you need.
The setValue action should have 1, 2, 3... and set the value on a label.
And you must repeat the pause,SetValue pair of actions as many times as values you want to have.
There is another option where you can use a variable; but the action sequence must be: pause,setValue,setValue where the first two are like before and the new one sets variable + 1 on variable.
Please let me know if something doesn't make sense or if you need more help.
Thanks Marc. I will try out your suggestions and see if we can make it a widget or reusable some way. Also i don't want to lose the ability to customize display later on.
Can you elaborate on the variable count down method?
We have created a countdown vp file example. Hope it helps.
This is great... So let say I have a timer that I can enter in via a keypad a time and when I hit start it counts down till zero. So I enter 12:00 then start and it counts down from 11:59 till the timer reaches 0 then resets to 00:00. Could you help me on this.
Sonia is there a function i can use to create this event instead of having to create this pause set states over and over
Here you can find attached a new example based on what you need.
This is great!! I really appreciate it and I understand the logic. Can I ask one more thing of you. Can you show me how I could enter in the time via a keyped 1-9 +0 that would preform the same function.
This is where I'm currently at! Timer works but I would like to add seconds and I would like it to function without needing to enter in a colon. As of now if you enter say 1 minute as 100... its doesn't function if you enter it in as 1:00 it doesn't function it currently has to be entered in as 01:00 for the clock to work. Is there a way to bypass this or force the clock to not need the colon or zero?
In case you don't want to use the colon on your expression, you can set the input as a text (you will lose the opportunity to use the hour) and then you will need to change all the expressions to not have to take into account the colon.
Could you so me how that expression might look I've tried and I seem be getting no where.
Unfortunately I can't provide you the exact expression, because each expression will be different. I will clarify first what the substring condition means:
"This function takes a string parameter A and two numeric parameters, X and Y, and returns a sub-string of A that comprises from the character at the index X to that at Y, given that strings' total range spans from 0 to n-1, where n is the number of characters of the string."
You should use the example provided and change each substring position, changing the new positions without the colon or comma. That will allow you to get hours / minutes without taking into account the colon.
I hope it helps.
Hi, sorry for bringing up an old thread, but I need help on this topic..
I have integrated the above sample to my project but with some modifications.
This is my scenario;
1. The countdown is on a layer3, and starts when a button is pressed on layer2. Layer2 is hidden when layer3 is shown. This works.
2. Layer2 can be triggered from layer1.
3. Layer3 should be hidden onTap or when the countdown ends, to show layer1.
4. When I tap on layer2, it hides and shows layer1. But when I tried to trigger layer2 from layer1, it shows layer3 with the still counting down from when it was tapped.
5. When the timer ends, it hides layer3 and shows layer1. But when I tried to trigger layer2 from layer1, it shows layer3 with timer 0.
How should I solve this problem?
Can you attach an example/snippet of your prototype so we can see what you are looking for and assist you more helpfully.
Hi Sonia, it is difficult to extract a snippet as the 3 layers I mentioned above are just 3 of the layers stack I have...
Replies have been locked on this page!