how about something like…
(note untested code)
[lua]-- keep a table of active transitions
local transitions = {}
– create objects
local platform1 = display.newImage(“platform.png”)
local platform2 = display.newImage(“platform.png”)
– forward reference to functions
local goLeft
local goRight
function goRight(obj)
transitions[obj] = transition.to(obj, {time=1000, obj.x+200, onComplete=goLeft})
end
function goLeft(obj)
transitions[obj] = transition.to(obj, {time=1000, obj.x-200, onComplete=goRight})
end
goRight(platform1)
goRight(platform2)[/lua]
then when you want to cancel all movement just iterate over the “transitions” table and do .cancel() on each item
[import]uid: 6645 topic_id: 4677 reply_id: 14812[/import]