justinmind-logo
 
Upvote 1

Countdown/ count up timer widgets

Answered Victor Conesa 9 years ago

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.

Best Answer
photo

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'

Replies (14)
photo
1

Hi Manish,


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.


Best,


Marc

photo
1

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.


Manish

photo
1

Marc,


Can you elaborate on the variable count down method?


Thanks,


Harlan

photo
1

Hi Harlan,


We have created a countdown vp file example. Hope it helps.


https://www.dropbox.com/s/dsoysituald...


Best,


Sonia Durán

photo
1

Sonia,


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.

photo
1

Sonia is there a function i can use to create this event instead of having to create this pause set states over and over

photo
1

Hi Harlan,


Here you can find attached a new example based on what you need.


https://www.dropbox.com/s/nc3qeto1gcz...


Best,


Sonia Durán

photo
1

Sonia,


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.

photo
1

Sonia,


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?


Thanks,


Harlan


https://www.dropbox.com/s/c23dn90rau8...

photo
1

Hi Harlan,


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.


Best,


Sonia Durán

photo
1

Sonia,


Could you so me how that expression might look I've tried and I seem be getting no where.


Thanks,


Harlan

photo
1

Hi Harlan,


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.


Best,


Sonia Durán

photo
1

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?

photo
1

Dear Sherman,


Can you attach an example/snippet of your prototype so we can see what you are looking for and assist you more helpfully.


Best,

photo
1

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...

photo
photo
1

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'

Leave a Comment
 
Attach a file