【问题标题】:Convert Actionscript 2 to Actionscript 3将 Actionscript 2 转换为 Actionscript 3
【发布时间】:2017-08-03 02:06:40
【问题描述】:

所以我正在使用 Animate CC,并且正在尝试为客户端修复旧的 fla 文件。我几乎是这个应用程序的菜鸟,并且无法使脚本正常工作。我认为问题是因为动作脚本是用 AS2 编写的。代码很简单,但我不知道要更改什么。

原代码:

_root.onEnterFrame = function ()
{
    if (about.p == news.p == org.p == pro.p == con.p == site.p)
    {
        black.gotoAndStop(1);
    } // end if
};

我尝试将脚本重新编写成这个,但它不起作用:

root.addEventListener(Event.ENTER_FRAME);
function (e:Event)
{
    if (about.p == news.p == org.p == pro.p == con.p == site.p)
    {
        black.gotoAndStop(1);
    } // end if
};

谁能帮我弄清楚?谢谢!!

【问题讨论】:

    标签: actionscript-3 flash actionscript


    【解决方案1】:

    您必须为事件监听器方法命名,然后将其绑定到“addEventListener”方法,如

    stage.addEventListener(Event.ENTER_FRAME, foo);
    function foo (e:Event):void
    {
        if (about.p == news.p == org.p == pro.p == con.p == site.p)
        {
            black.gotoAndStop(1);
        } // end if
    }
    

    【讨论】:

    • 删除末尾的;。将root 更改为stage。
    猜你喜欢
    • 2017-12-24
    • 2019-08-11
    • 2011-10-22
    • 2014-09-17
    • 1970-01-01
    • 2012-02-21
    • 2013-09-21
    • 2017-09-03
    • 1970-01-01
    相关资源
    最近更新 更多