The timer.performWithDelay idea sounded good! So, I tried it with 5 and it didn’t work. I tried it again with 50, then 500 and still it doesn’t work. This is indeed a strange problem.
make a function… that will work in composer…
OK, I tried making the transition pause as a function. I created all the stars, then called the function after all stars had been placed on screen. No go, the transition will still not pause. This is bizarre, same code works in storyboard but not composer…go figure!
Sounds like it’s time for a bug report. Can you package up a simple project folder that exhibits the bug and submit it? I know it’s a pain, but it’s your best bet to get it fixed (it’s also confirmation that it’s not specific to your app).
I’ve been experimenting with solutions for this thread for a while, and I’ve been able to consistently get results with the below code:
local transitionItem2Stash = {} function pauseAllItem1Trans() for i=1, #transitionItem2Stash do transition.pause(transitionItem2Stash[i]) end print("pausing now") end function resumeAllItem1Trans() for i=1, #transitionItem2Stash do transition.resume(transitionItem2Stash[i]) end print("resuming now") end local rectTest = display.newRect(display.contentCenterX, display.contentCenterY, 80,80) local function rotateTest1() local function rotateTest2() transitionItem2Stash[#transitionItem2Stash+1] = transition.to( rectTest, { time=3000, rotation = -360, onComplete=rotateTest1 } ) print("rotating again here") end transitionItem2Stash[#transitionItem2Stash+1] = transition.to( rectTest, { time=3000, rotation = 360, onComplete=rotateTest2 } ) print("rotating first here") end rotateTest1() timer.performWithDelay(4000, pauseAllItem1Trans, 1) timer.performWithDelay(8000, resumeAllItem1Trans, 1)
I can reliably pause and resume transitions in this way. Can you attempt to implement this with your code and see if it has any affect?
Alex@Panc, This looks like an interesting idea to try. I just left home for a few hours, but when I return I’ll try to see if I can implement this idea with my code. Thanks!
The problem is finally solved! Thanks to ideas from SonicX278 and schroederapps.
SonicX278 suggested I try creating a function to pause the stars. So I tried this and it didn’t work.
local function stop() transition.pause() end transition.to(star,{y=offScreen\*2,time=objSpeed\*speedFactor}) if resume==2 then stop() end
Schroederapps suggested I use a timer to delay the transition.pause(). This is what I used and that didn’t work.
transition.to(star,{y=offScreen\*2,time=objSpeed\*speedFactor}) if resume==2 then timer.performWithDelay(1,transition.pause) end
But, when I combined the two ideas it worked! Here’s what I did.
local function stop() transition.pause() end transition.to(star,{y=offScreen\*2,time=objSpeed\*speedFactor}) if resume==2 then timer.performWithDelay(1,stop) end
Thanks everyone for your help!
Guy