1
votes

so I'm using Animate CC and I'm trying to fix an old fla file for a client. I'm pretty much a noob to this app and have trouble making the script work. I think the problem is because the actionscript was written in AS2. The code is simple but I couldn't figure out what to change.

The original code:

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

I tried re-write the script into this, but it's not working:

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
};

Could anyone help me figure it out? Thanks!!

1

1 Answers

3
votes

You must give the event listener method a name and than bind this to the "addEventListener" method like

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
}