How can I complete the startAnimNode() / contAnimNode() / finishAnimNode() sequence in the ‘for nodeIndex = 1, 3 do’ loop for all of the three nodes before the program continues to run and calls the task3() - task6(), task2() functions?
local animInProgress = false
local theNodes = {
node1,
node2,
node3
}
local theNodesIndex
function finishAnimNode(event)
-- finish up
animInProgress = false
end
function contAnimNode(event)
-- fade out
transition.to( theNodes[theNodesIndex], {time=500, alpha=1.0, onComplete= finishAnimNode})
end
function startAnimNode(index)
-- fade out
animInProgress = true
transition.to( theNodes[theNodesIndex], {time=500, alpha=0.25, onComplete=contAnimNode})
end
function checkNodes()
task1()
for nodeIndex = 1, 3 do
task2()
theNodesIndex = nodeIndex
startAnimNode()
task3()
task4()
end
task5()
task6()
end
I created a flag called ‘animInProgress’ but no matter how I use it the program will continue to run and end with the possibility of the other tasks either being called when they shouldn’t, or NOT being called when they should.
[import]uid: 295 topic_id: 1740 reply_id: 301740[/import]