Timers issue in the new CoronaCards WP8 build (2014.2369)

Joshua,

I think I got to the problem - it seems that after overlayEnded event occurs no transitions are deployed from within button listeners. I tired to add this simple code to my button instead of my regular restartGame() function:

function button:tap() print("TAP TAP") local circleTrans1 local circleTrans2 local function makeCircle2() print("circle2 BEGIN") local circle2 = display.newCircle( \_W\*0.5, \_H\*0.5+30, 30 ) circle2.alpha = 0 local function nilOut() print("NIL BEGIN") transition.cancel(circleTrans1) transition.cancel(circleTrans2) circleTrans1 = nil circleTrans2 = nil end circleTrans2 = transition.to(circle2, { time = 500, alpha = 1, onComplete = nilOut }) end local circle = display.newCircle( \_W\*0.5, \_H\*0.5, 30 ) circle.alpha = 0 circleTrans1 = transition.to(circle, { time = 500, alpha = 1, onComplete = makeCircle2 }) end

So when I click the button after overlayEnded event occurred - I’m getting “TAP TAP” printed in the output but no visible circles, and no more print outputs. When I change circle.alpha = 1 and circle2.alpha = 1, then I’m getting “TAP TAP” output and one visible circle. 

That means, that circleTrans1 transition isn’t deployed at all after overlayEnded event.

I tried to put the same code inside the scene:overlayEnded function and then the transition worked fine.

They are not deployed when they are triggered from inside button listeners.

Does it make any sense?

No it’s not that. I’ve made a simple app to test it out and the transitions alone work fine after overlayEnded event… Have no idea what’s going on here.

OK, so now I removed two transitions from my code and the other transitions work fine. :huh:

I don’t know why these two purely visual elements were causing a bug in the latest build but I can live without them.

We delete this thread if you want.

I had a quick look at Corona’s storyboard library and I can see that it contains some print() function.  I’m wondering if those are the cause of the temporary hanging/blocking since each print() function blocks the app for about 3-4 milliseconds (they’re expensive on WP8).

Have you tried running your app without the Visual Studio debugger?

That is, after you deploy your app to the WP8 device, stop the debugger, and then run the app yourself manually from the device.  Does it stop blocking then?

Yes, I tried it but it didn’t make any change. I noticed that I get a slightly better performance when I stop debugging, but unfortunately not this time. It might be the storyboard, still I’m wondering why it’s been working with the previous build and now it doesn’t. 

Anyways - I don’t mind removing those 2 additional transitions so I’m happy that I got it to work.

Oh, actually I made a quick test and tried to load the overlay as a display.newGroup requiring a regular module, not a storyboard scene. The results were exact the same, so I guess the bug is somewhere else, not in storyboard api.

Well, let’s keep this thread open, because I do eventually want to know what exactly is causing this issue.

I have a hard time believing it’s a timer issue though.  Timers will either elapse on time or late… and never early now.  The only issue you might have with them is if you have something blocking the main UI thread.  You see, your physics based system is framerate driven by default, but timers are based on the device’s clock (system ticks really).  What I mean by this is if you block the main UI thread for a minute, then you’ll find that your physics system will step by a small duration, but all of your timers may elapse all at once.  I hope what I’m saying makes sense.  So, I’m wondering if something is blocking the main UI thread in your app (which is what we need to track down), which is why your timers seem to be going off early (but by your device’s clock, they’re actually late).