timer onComplete method

it would be useful to have an event that fires when all iterations of a timer are complete

(combined with my other request for the timer to start immediately this could be

timer.performWithDelay(1000, doSomething, 100, {onComplete=finishSomething, immediate=true})

presumably this wouldnt break old code either, as the first 3 parameters are the same

thanks
j.

note i did actually find a fix to fire the first call immediately

I'm looking for something like an onComplete for a timer, too. Would be very nice to have such a feature.

What are the other options to implement a similar functionality with the given Lua functions? I guess i would do it like this right now:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
local counter = 100
 
local function listener( event )
    print( "Doing some stuff here" )
    counter = counter - 1
end
 
timer.performWithDelay(1000, listener, counter)
 
while counter >= 0 do
   print ("Waiting for timer to finish") 
end
 
print("Proceeding in code")

your concept is right but you've implemented it wrong... that while loop wouldnt work there

anyway listener has event.count (it's in the documentation) so you can check that in the listener itself to determine if the timer is complete

views:1849 update:2011/9/18 20:20:08
corona forums © 2003-2011