as3 |如何在不使用函数的情况下编写onComplete代码

问题描述

| 这是一个简单的问题,但我似乎无法正确解决。 而不是编写此代码(= onComplete函数):
Tweener.addTween(resultsIntro,{alpha:0,time:0.5,transition:\"easeIn\",onComplete:func});

function func() {
    myResults.removeChild(resultsIntro);
}
我想写这样的东西(由于我不知道如何正确写,所以它不起作用):
Tweener.addTween(resultsIntro,onComplete:(myResults.removeChild(resultsIntro);)});
因为我不需要此功能-如何在同一位置编写onComplete代码?     

解决方法

        
Tweener.addTween(resultsIntro,{alpha:0,time:0.5,transition:\"easeIn\",onComplete:function() { myResults.removeChild(resultsIntro); });
    ,        尝试使用匿名函数(){}。 此技术类似于JavaScript闭包。