Hi,
is it possible to display time on screen.
If yes, please give example.
Thanks. [import]uid: 75428 topic_id: 15100 reply_id: 315100[/import]
Hi,
is it possible to display time on screen.
If yes, please give example.
Thanks. [import]uid: 75428 topic_id: 15100 reply_id: 315100[/import]
hope this helps
[lua]local timeTable,timetxt
local function displayTime()
timeTable = os.date("*t")
if timetxt then timetxt:removeSelf() end
timetxt = display.newText(timeTable.hour…":"…timeTable.min…":"…timeTable.sec,50,50,nil,20)
end
timer.performWithDelay(1000,displayTime,0)[/lua] [import]uid: 71210 topic_id: 15100 reply_id: 55868[/import]
Thanks.
It’s displaying system date and time but I want to assign 30 second time (in reverse order) in my apps and if time is become 0 then I want some activity.
Thanks. [import]uid: 75428 topic_id: 15100 reply_id: 55870[/import]
did a stupidity in the first code that I posted. I can’t delete it also. it can be re written like this.
[lua]local timeTable
local timetxt = display.newText(“Time :”,150,150,nil,25)
local function displayTime()
timeTable = os.date("*t")
timetxt.text = timeTable.hour…":"…timeTable.min…":"…timeTable.sec
end
timer.performWithDelay(1000,displayTime,0)
[lua] [import]uid: 71210 topic_id: 15100 reply_id: 55878[/import]
you may use this.
[lua]local remainingTime = 10
local timer1
local timedisplay = display.newText(“Time :”…remainingTime,50,50,nil,25)
local function timeChange()
remainingTime = remainingTime - 1
timedisplay.text = “Time :”…remainingTime
if remainingTime == 0 then
print(“Do Something”)
timer.cancel(timer1)
end
end
timer1 = timer.performWithDelay(1000,timeChange,0)[/lua] [import]uid: 71210 topic_id: 15100 reply_id: 55877[/import]
Thanks. [import]uid: 75428 topic_id: 15100 reply_id: 55980[/import]