Swiping to change the digit of Hours and Minutes in Digital Clock in Corona

Hi all,

I would like change the digit of the hours and minutes while I swiping on the digit of the Digital Clock.

For example,The digital Clock initially show 10:00 (10 O’Clock).When I swipe down on the digit of the hour,the hour digit should be change to 11:00 and When I swipe up on the digit of the hour,the hour digit value should be change to 9:00.

Please advise me how to do that.Is it possible or not?..

Thanks…

Best Regards,

John

In your own app? …detect a swipe using the touch event and update the display.

Yes…in my own app…thanks…:slight_smile:

Well, take a look at the events API documentation:

http://docs.coronalabs.com/guide/events/detectEvents/index.html

http://www.coronalabs.com/blog/2011/09/24/tutorial-how-to-drag-objects/

You might need this function from the mathlib.lua library:

http://developer.coronalabs.com/code/maths-library

-- returns the distance between points a and b function lengthOf( a, b )     local width, height = b.x-a.x, b.y-a.y     return (width\*width + height\*height)^0.5 -- math.sqrt(width\*width + height\*height)         -- nothing wrong with math.sqrt, but I believe the ^.5 is faster end

Basically, while a touch event is happening, check for the direction moved being -ve or +ve and once a threshold distance has been passed update the display.

You cannot change the device time from within a Corona app, I believe. I’m not sure any app except the Apple apps have that ability.

In your own app? …detect a swipe using the touch event and update the display.

Yes…in my own app…thanks…:slight_smile:

Well, take a look at the events API documentation:

http://docs.coronalabs.com/guide/events/detectEvents/index.html

http://www.coronalabs.com/blog/2011/09/24/tutorial-how-to-drag-objects/

You might need this function from the mathlib.lua library:

http://developer.coronalabs.com/code/maths-library

-- returns the distance between points a and b function lengthOf( a, b )     local width, height = b.x-a.x, b.y-a.y     return (width\*width + height\*height)^0.5 -- math.sqrt(width\*width + height\*height)         -- nothing wrong with math.sqrt, but I believe the ^.5 is faster end

Basically, while a touch event is happening, check for the direction moved being -ve or +ve and once a threshold distance has been passed update the display.

You cannot change the device time from within a Corona app, I believe. I’m not sure any app except the Apple apps have that ability.

this is my problem also… just want to change or edit the time to use it in daily time record application.

this is my problem also… just want to change or edit the time to use it in daily time record application.