how can I "cancel" a transition.to on a display object once it is underway?

Question - how can I “cancel” a transition.to on a display object once it is underway?

Background: I have a WidgetCandy “multiline text widget” I’m using for a UI text display for a user. If there is a notification then the text object is used to show the text, and then I use “transistion.to” to fade it out using Alpha. The issue is if I refresh the object (same object, reusing it) for the next text notification, then if it is still during the transistion.to fade out, the fade out will keep occurring on the new text I want displayed.

What’s the general way around halting a transistion.to on a display object, assuming you’re trying to use the same object? [import]uid: 140210 topic_id: 27806 reply_id: 327806[/import]

Assign the transition to a variable. I usually put it as part of the object itself.

object.fade = transition.to( object, { time = 1000, alpha = 0 })

If I need to break the transition and start it again, I do this:

if object.fade then transition.cancel( object.fade ) end object.fade = transition.to( object, { time = 1000, alpha = 1 } )

I always use an if/then to prevent an error by trying to cancel a transition that doesn’t exist yet.

Hope that helps.
[import]uid: 6084 topic_id: 27806 reply_id: 112604[/import]

@BeyondtheTech: Very cool! Love this part " I usually put it as part of the object itself. " I cannot believe I did not think of that. I usually give them a special name and it just add clutter.

Thanks again.

Mo
(LairdGames) [import]uid: 100814 topic_id: 27806 reply_id: 112605[/import]

excellent - thanks [import]uid: 140210 topic_id: 27806 reply_id: 112613[/import]