2

我首先通过单击按钮调用了以下函数。

function chooseRosaryIN(evt:Event)
{
    TweenLite.to(chooseRosary, 3, {y:chooseRosaryY,  ease:Cubic.easeOut});
}

稍后,如果我想调用与常规函数调用相同的函数,我该怎么做?可以做到吗?例如,如果我称之为 chooseRosaryIN();

我收到此错误: 场景 1,图层“功能”,第 1 帧,第 227 行 1136:参数数量不正确。预期 1。

我宁愿不编写两个函数来调用这个补间。有任何想法吗?谢谢

4

2 回答 2

4

将请求的参数更改为 null :

function chooseRosaryIN(evt:Event = null) {
    TweenLite.to(chooseRosary, 3, {y:chooseRosaryY,  ease:Cubic.easeOut});
}

您也可以使用 '... args' :

function chooseRosaryIN(... args) {
于 2012-09-22T08:07:47.550 回答
1

我刚刚找到了答案。此代码也有效。我可以调用它并在函数中添加一个“null”。

function chooseRosaryIN(evt:Event) 
    {
    TweenLite.to(chooseRosary, 3, {y:chooseRosaryY,  ease:Cubic.easeOut});
    }
chooseRosaryIN(null); /// WORKS without an event call. :)

在此页面上找到答案:http ://www.actionscript.org/forums/showthread.php3?t=179842

于 2012-09-22T08:11:57.057 回答