self (makes chaining easier)
Inserts a callback at a particular position.
The function to be called
The time in seconds (or frames for frames-based timelines) or label at which the callback should be inserted. For example, myTimeline.addCallback(myFunction, 3)
would call myFunction() 3 seconds into the timeline, and myTimeline.addCallback(myFunction, "myLabel")
would call it at the “myLabel” label.myTimeline.addCallback(myFunction, "+=2")
would insert the callback 2 seconds after the end of the timeline.
(default = null
) — An Array of parameters to pass the callback
(default = null
) — The scope in which the callback should be called (basically, what “this” refers to in the function). NOTE: this parameter only pertains to the JavaScript and AS2 versions; it is omitted in AS3.
self (makes chaining easier)
Inserts a callback at a particular position. The callback is technically considered a zero-duration tween, so if you getChildren()
there will be a tween returned for each callback. You can discern a callback from other tweens by the fact that its target is a function matching its vars.onComplete
and its duration
is zero.
If your goal is to append the callback to the end of the timeline, it would be easier (more concise) to use the call()
method. Technically the add()
method can accommodate adding a callback too (like myTimeline.add(myFunction, 2)
or myTimeline.add(myFunction, "+=2")
) but add()
doesn't accommodate parameters.