I create balloon objects like this:
[blockcode]
local balloons = display.newGroup()
function spawnBalloon(group)
local i = math.random(1,3)
local balloon = display.newImageRect(group, “images/balloon” … i … “.png”, 60,76)
i = math.random(1,2)
function free(obj)
if(obj.trans ~= nil) then
transition.cancel(obj.trans)
end
obj:removeSelf()
end
balloon.y = math.random(50,150)
if (i == 1) then
balloon.x = -60
balloon.trans = transition.to(balloon, {time = math.random(1200, 1400), x = display.contentWidth+60, y = balloon.y + math.random(0,100)-50, onComplete=free})
else
balloon.x = display.contentWidth + 60
balloon.trans = transition.to(balloon, {time = math.random(1200, 1400), x = -60, y = balloon.y + math.random(0,100)-50, onComplete=free})
end
i = (math.random(1,2) / 2)
balloon:scale(i, i)
return balloon
end
spawnBalloon(balloons)
[/blockcode]
So all my balloon objects are held withing the balloons display group.
Notice that when the balloon has finished it’s transition it’s freed up. All OK
Now the question is, when a user quits the game, in my clean up code how do I remove each balloon object AND cancel each balloon objects transition?
As the balloons group is part of Directors localGroup then the actual display objects are being freed but how do I ensure the each objects transition is cancelled also???
Ta!
[import]uid: 9371 topic_id: 7403 reply_id: 307403[/import]