2011-06-11 72 views
0

这是一个简单的问题,但我似乎无法做到。as3 |如何在不使用函数的情况下编写onComplete代码

而不是写这个(=一个的onComplete功能):

Tweener.addTween(resultsIntro, {alpha:0, time:0.5, transition:"easeIn", onComplete:func}); 

function func() { 
    myResults.removeChild(resultsIntro); 
} 

我想写这样的事情(和它不工作,因为我不知道怎么写右):

Tweener.addTween(resultsIntro, {alpha:0, time:0.5, transition:"easeIn", 
       onComplete:(myResults.removeChild(resultsIntro);)}); 

因为我不需要这个函数 - 我怎样才能在同一个地方写onComplete代码?

回答

4
Tweener.addTween(resultsIntro, {alpha:0, time:0.5, transition:"easeIn", 
      onComplete:function() { myResults.removeChild(resultsIntro); }); 
1

尝试匿名函数(){}。 这种技术与JavaScript关闭类似。

相关问题