In “scene1” I have this code:
local trans function transition1( obj ) local clojure = function() obj.width = 0; transition1(obj) end local options = { width = 200, time = 3000, onComplete = clojure } trans = transition.to( obj, options ) end // Scene Create: local rect = display.newRect(sceneGroup, 300, 300, 0, 20) transition1(rect) // Scene Show: elseif ( phase == "did" ) then transition.resume(transition1) end
When I click on a button in “scene1” this code runs:
function establishEvent( ) transition.pause(transition1) composer.gotoScene ( "scene2" ) end
Back from “scene2” to “scene1” the transition doesn’t resume. At first, I thought it’s because the transition gets called first in “Scene Create” then resumed in “Scene SHow” but after I used a boolean to check if it’s the first time the transition runs, the result was the same.
What am I doing wrong here?
edit:
// Scene Show: elseif ( phase == "did" ) then transition.resume(trans) \<\<-- passing the variable that holds the transition end
function establishEvent( ) transition.pause(trans) \<\<-- passing the variable that holds the transition composer.gotoScene ( "scene2" ) end