@maletta, thanks for your suggestion. I used your idea removing the onComplete event of the second transition to get this working.
@jayantv, thanks for the help, very informative article.
You might want to change the code errors (tranistion.to instead of transition.to)
The sample at the bottom only fades out, i fixed it by moving:
tranistion.to(rect,{time=1000,alpha=0, onComplete = function1})
to the bottom of the code. Then it works properly.
local function1, function2
local trans
local rect = display.newRect(10,10,300,40)
rect:setFillColor(255,255,255)
function function1(e)
trans = transition.to(rect,{time=1000,alpha=1, onComplete=function2})
end
function function2(e)
trans = transition.to(rect,{time=1000,alpha=0, onComplete=function1})
end
transition.to(rect,{time=1000,alpha=0, onComplete = function1})
So the solution for me was:
local function1, function2
function function1(e)
-- Left
transition.to( wave1, {time=10000, x=1, onComplete=function2})
transition.to( wave2, {time=10000, x=1620})
end
function function2(e)
-- Right
transition.to( wave1, {time=10000, x=1620, onComplete=function1})
transition.to( wave2, {time=10000, x=1})
end
-- Right
transition.to( wave1, {time=10000, x=1620, onComplete=function1})
-- Left
transition.to( wave2, {time=10000, x=1})
Again, thanks all for the help!
[import]uid: 50459 topic_id: 14330 reply_id: 53111[/import]