addCaller()

Availability

AS2 and AS3.

Usage

Tweener.addCaller(target:Object, tweeningParameters:Object):Void

Parameters

target:Object — Any object that will be called successively. These objects are usually MovieClip, TextField, or Sound instances, or any other custom object that you want to run a given function in it.

tweeningParameters:Object — An object containing some built-in Tweener properties used when defining tweening parameters.

Description

This method is used to call a function successively inside of an object an specific number of times, for an specific time. The big advantage is that it allows it to use different transitions when doing so, changing the interval between each function call in the process.

Like addTween, it has a pretty loose syntax, with a few hard-coded parameters, allowing for a plethora of different transition options to be declared.

There are many different options available, so check the documentation for each different feature on the tweening parameters page, and see other uncommon properties you can use on the special properties page.

Returns

Nothing.

Examples

// Call a function 10 times during 5 seconds
this.warn = function() {
	trace("function is called".);
};
Tweener.addCaller(myMovieClip, {onUpdate:this.warn, time:5, count:10});
// Call a function 10 times during 5 seconds, going slowly at first, but then faster as time progresses
this.warn = function() {
	trace("function is called".);
};
Tweener.addCaller(myMovieClip, {onUpdate:this.warn, time:5, count:10, transition:"easeinquad"});
// Blink a movieclip faster and faster, waiting at least one frame until calling the function again
this.blink = function() {
	this._visible = !this._visible;

};
Tweener.addCaller(myMovieClip, {onUpdate:this.blink, time:5, count:10, transition:"easeinquad", waitFrames:true});

See also

addTween, Tweening parameters