quick question: transitions

I just have this question that maybe someone can answer. when using a transition, after it has run its length, is it automatically destroyed? Or if i have a object that is currently in a transition and i destroy the object, is the transition also destroyed? I guess this question pertains to Timers also.
Just curious as i would rather not have memory leaks everywhere, thank you [import]uid: 19620 topic_id: 8227 reply_id: 308227[/import]

When a transition completes it is automatically destroyed. I don’t know what happens if you delete the object before the transition completes but I’m guessing that causes an error. So the problem there wouldn’t be memory leaks, it would be crashing.

I wish I had my game’s code in front of me right now so I can see what I do. I’m pretty sure I cancel transitions before removing objects, I’ll have to double check tonight. [import]uid: 12108 topic_id: 8227 reply_id: 29346[/import]

Ok, well im sure that canceling a transition before deleting an object is the smart way to code anyways. so ill do it to be on the safe side, thanks [import]uid: 19620 topic_id: 8227 reply_id: 29350[/import]

this is how i’d do it, to be safe…

[lua]obj.myTransition = transition.to(obj, {time=1000, onComplete=myComplete)

– later…
if(obj.myTransition~=nil) then
transition.cancel(obj.myTransition)
obj:removeSelf()
end[/lua]
[import]uid: 6645 topic_id: 8227 reply_id: 29678[/import]