removeTweens()

Availability

AS2 and AS3.

Usage

Tweener.removeTweens(target:Object [, property1:String, property2:String, ...]):Boolean;

Parameters

target:Object — The object that you want to remove tweens from. Usually, a MovieClip, TextField, or some instance of any other class which has numeric properties. This parameter is required.

property1..propertyN:String — The name of the property or properties currently being tweened that you want to remove. This is a string containing the name of the property, and any number of strings can be specified as parameters. If no property name is specified, all tweenings for this specific target are removed.

Description

Removes specific tweenings of specific objects, so they're not executed anymore, nor are their events called. All currently existing tweenings that match the target (or target and specified properties, if any) are removed, including tweenings currently delayed or paused.

Returns

Boolean — true if any property tweening was successfully removed, false if otherwise.

Examples

// Removes all tweenings of a specific object
Tweener.removeTweens(myMovieClip);
// Adds a _x and a _y tweening to an object, then removes the _x one only
Tweener.addTween(myMovieClip, {_x:10, _y:20, time:1});
Tweener.removeTweens(myMovieClip, "_x");
// Removes the _x, _y and _alpha tweening of an object
Tweener.removeTweens(myMovieClip, "_x", "_y", "_alpha");

Notes

When removing a tweening from an object, custom events attached to it are not automatically removed unless all tweening properties are also removed. For example:

Tweener.addTween(myMovieClip, {_x:10, _y:20, time:1, onUpdate:this.redraw});
Tweener.removeTweens(myMovieClip, "_x");

On the above example, the onUpdate event will continue to be called, because the _y tweening still exists. However, if the _y tweening is also removed, like so:

Tweener.addTween(myMovieClip, {_x:10, _y:20, time:1, onUpdate:this.redraw});
Tweener.removeTweens(myMovieClip, "_x");
Tweener.removeTweens(myMovieClip, "_y");

Or even all at the same time:

Tweener.addTween(myMovieClip, {_x:10, _y:20, time:1, onUpdate:this.redraw});
Tweener.removeTweens(myMovieClip, "_x", "_y");

Then custom events are deleted, and as such, onUpdate ceases to be called.

See also

addTween, removeAllTweens