1

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 Answer 1

3

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
}
Sign up to request clarification or add additional context in comments.

1 Comment

Remove the ; at the end. Change root to stage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.