我首先通过单击按钮调用了以下函数。
function chooseRosaryIN(evt:Event)
{
TweenLite.to(chooseRosary, 3, {y:chooseRosaryY, ease:Cubic.easeOut});
}
稍后,如果我想调用与常规函数调用相同的函数,我该怎么做?能做到吗?例如,如果我调用此 ChooseRosaryIN();
我收到此错误: 场景 1,“函数”层,第 1 帧,第 227 行 1136:参数数量不正确。预计1.
我宁愿不编写两个函数只是为了调用这个补间。有任何想法吗?谢谢
最佳答案
将请求的参数更改为 null :
function chooseRosaryIN(evt:Event = null) {
TweenLite.to(chooseRosary, 3, {y:chooseRosaryY, ease:Cubic.easeOut});
}
您还可以使用“...args”:
function chooseRosaryIN(... args) {
关于actionscript-3 - as3 在没有事件的情况下调用事件函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12541873/