Tip for Error: 1087: Syntax error: extra characters found after end of program.

by troy on January 27, 2009

Say we have this function, missing the start { after the void

13: function onMouseUpEvent(evt:MouseEvent):void
14:    this.drawing = false;
15:    stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveEvent);
16:  }

You will get a compile time error saying that the problem is around line 16. when really it's on line 13. Here's the correct code.

<code>

13: function onMouseUpEvent(evt:MouseEvent):void {
14:    this.drawing = false;
15:    stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveEvent);
16:  }

</code>

{ 2 comments… read them below or add one }

Kirk M. Schafer August 16, 2009 at 1:45 am

This can also occur if–as i did–one accidentally creates a function and variable name starting with an illegal character, e.g., a digit (0-9). I should have known better at my level of experience, but the compiler should have known better, too.

troy August 16, 2009 at 2:13 am

thanks for the contribution Kirk! I’ve hit that snag before too working with KeyCodes

Leave a Comment

Previous post:

Next post: