MC Tween: it saves the world.™

Home | Using MC Tween | Documentation | AS2 usage notes | Animation Types | Downloads | Examples | Extensions | Author & Disclaimer | Links

.onTweenComplete()

Applies To

MovieClip, Sound, TextField

Availability

Flash 6 and above, using AS1 or AS2.

Usage

<MovieClip|Sound|TextField>.onTweenComplete = <function>;

Parameters

function : The name of a function, in reference (object) form, or an anonymous function.

Returns

N/A

Description

Event handler; invoked immediately after a tweening has ended. This function is called once for every tweened property, and receives the property name as a single string parameter. This function is defined once per object, not per tweening, so do not mistake this by tween()'s callback parameter; this event gets called once for every property being tweened.

This event handler works similarly to the MovieClip's built-in event handlers, like .onEnterFrame, .onRollOver, etc.

Examples

// Warns every time a tweening ends for a MovieClip object, using a named function
warnOnEnd = function(propName) {
 trace ("Tweening "+propName+" has ended.");
};
<MovieClip>.onTweenComplete = warnOnEnd;

// Warns every time a tweening ends for a MovieClip object, using an anonymous function
<MovieClip>.onTweenComplete = function(propName) {
 trace ("Tweening "+propName+" has ended.");
};

// Do something after a TextField _x tween has ended, using an anonymous function
<TextField>.onTweenComplete = function(propName) {
 if (propName == "_x") {
 trace ("The _x tweening has ended!");
 // do something here
 }
};

See Also

onTweenUpdate()

MC Tween· Zeh Fernando, 2003-2006 · Proudly hosted at DreamHost · Disclaimer