Reputation: 7758
this is an easy question but I can't seem to get it right.
Instead of writing this (=an onComplete function):
Tweener.addTween(resultsIntro, {alpha:0, time:0.5, transition:"easeIn", onComplete:func});
function func() {
myResults.removeChild(resultsIntro);
}
I want to write something like this (and it is not working because I don't know how to write it right):
Tweener.addTween(resultsIntro, {alpha:0, time:0.5, transition:"easeIn",
onComplete:(myResults.removeChild(resultsIntro);)});
because I don't need this function - how can I write the onComplete code in the same place?
Upvotes: 0
Views: 1102
Reputation: 696
Try anonymous function(){}. This technique is similar to JavaScript closures.
Upvotes: 1
Reputation: 2482
Tweener.addTween(resultsIntro, {alpha:0, time:0.5, transition:"easeIn",
onComplete:function() { myResults.removeChild(resultsIntro); });
Upvotes: 4