actionscript-3 - as3 在没有事件的情况下调用事件函数?

标签 actionscript-3 flash function events

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

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/

相关文章:

影片剪辑结束的Flash事件监听器?

c++ - 如何将结构作为参数传递给其他函数进行输入,然后在原始函数处输出

php - 使用 jQuery 对话框显示 mysql_error 消息

actionscript-3 - Flex3 中的 TLS 支持

ios - ActionScript 3 中 iPhone 的垂直滚动

css - Flashplayer 在容器外溢出

jquery - 闪过 jquery 幻灯片

actionscript-3 - 只能看到 Flash AS3 中容器边界内的内容?

c++ - 在成员函数中访问参数的类成员

apache-flex - Actionscript 3 - 解析 yyyy-mm-dd hh :mm:ss to a Date object? 的最快方法