Skip to main content
Known Participant
November 11, 2010
Answered

Syntax error: expecting rightparen before not.

  • November 11, 2010
  • 1 reply
  • 1561 views

Another textbook problem!

The step word for word in my textbook is:

The following four lines of code placed above the goto statement for the function called by the home button so the animation does not play when the Home button is clicked.


if (animationInstance.parent != null)

{

     animationinstance.parent.removeChild(animationInstance);

}

So.. I added this step to my code for the assignment and when I test it, I'm getting error:

Scene 1, Layer 'actions', Frame 1, Line 29 1084: Syntax error: expecting rightparen before not.

Here's my entire code for the frame:

import flash.events.MouseEvent;

stop();
var animationInstance:animationMC = new animationMC();

graphicsBtn.addEventListener(MouseEvent.CLICK, goto2);
function goto2(Event:MouseEvent)
{
    gotoAndStop(2);
}
animationsBtn.addEventListener(MouseEvent.CLICK, goto3);
function goto3(Event:MouseEvent)
{
    gotoAndStop(3);
}
formBtn.addEventListener(MouseEvent.CLICK, goto4);
function goto4(Event:MouseEvent)
{
    gotoAndStop(4);
}
photoBtn.addEventListener(MouseEvent.CLICK, goto5);
function goto5(Event:MouseEvent)
{
    gotoAndStop(5);
}
homeBtn.addEventListener(MouseEvent.CLICK, goto1);
function goto1(Event:MouseEvent)
{
    if(animationInstance.parent ! = null)
    {
        animationInstance.parent.removeChild(animationInstance);
    }
    gotoAndStop(1);
}

Any help is appreciated!!

This topic has been closed for replies.
Correct answer Ned Murphy

! = should be !=   no space ( ! is what they are calling "not" -- shoulda just used ! )

And I think I already mentioned to not use "Event" like you do

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
November 11, 2010

! = should be !=   no space ( ! is what they are calling "not" -- shoulda just used ! )

And I think I already mentioned to not use "Event" like you do

beckalyceAuthor
Known Participant
November 11, 2010

Ha. Now I feel dumb! Thank you!!

I should know better, I work with SQL at work all day.