So in my code I added a transition with an onComplete if I set it as { onComplete=myFunction }
it does not trigger the first time on the second time the transition is called it runs myFunction
So this fails to execute showAll(event) when I see the transition complete so I know it at least runs the width/height portion of the transition. if I run it more than once it runs the onComplete each subsequent run
local bg = display.newRect(myGroup, 0, 0, 50, 50) bg:setFillColor(1,1,1,1) transition.to( bg, { time=200, width=500, height=500, onComplete=showAll } ) function showAll(event) local rect = display.newRect(myGroup, 5, \_H - 185, \_W - 10, 180) transition.to( viewGroup, { time=200, alpha=1 } ) end
This on the other hand works on all calls to that transition, the only difference is that I wrapped the event function with a function() … end
local bg = display.newRect(myGroup, 0, 0, 50, 50) bg:setFillColor(1,1,1,1) transition.to( bg, { time=200, width=500, height=500, onComplete=function(event) showAll(event) end } ) function showAll(event) local rect = display.newRect(myGroup, 5, \_H - 185, \_W - 10, 180) transition.to( viewGroup, { time=200, alpha=1 } ) end
I am going to use the latter but not sure if there is a reason why it occurs.