Skip to main content
Participant
April 6, 2021
Answered

AS3 Project Error: 1087: Syntax error: Extra characters found...

  • April 6, 2021
  • 2 replies
  • 959 views

Hello,

 

I'm using Adobe Animate 2018 to make a small platformer game to keep myself entertained when I'm bored.

 

Everything was alright, until I tried to add new levels. Whenever I run my game, it says this:

1087: Syntax error: Extra characters found after end of program.

 

It shows the error in another location, but here's the whole code including the problem area:

 

stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);

if(e.keyCode == Keyboard.DOWN) ; {
downPressed = true;
if(doorOpen && player.hitTestObject(back.other.lockedDoor)){
nextLevel();
}
}

if(e.keyCode == Keyboard.RIGHT){
rightPressed = true;
}

if(e.keyCode == Keyboard.UP){
upPressed = true;
}

if(e.keyCode == Keyboard.DOWN){
downPressed = true;
}
}

This topic has been closed for replies.
Correct answer JoãoCésar17023019

Hi.

 

It's probably because you have an extra semicolon in this if statement:

if(e.keyCode == Keyboard.DOWN) ; {

 

Just remove it and the error may go away.

 

Regards,

JC

2 replies

JoãoCésar17023019
Community Expert
Community Expert
April 6, 2021

Actually, you also have an extra curly brace in the end. If you remove it you should be good to go.

JoãoCésar17023019
Community Expert
JoãoCésar17023019Community ExpertCorrect answer
Community Expert
April 6, 2021

Hi.

 

It's probably because you have an extra semicolon in this if statement:

if(e.keyCode == Keyboard.DOWN) ; {

 

Just remove it and the error may go away.

 

Regards,

JC

Flash5CB5Author
Participant
June 14, 2021

Thank you very much! Even though I found another way of going to another level, thanks for the tip! 🙂

JoãoCésar17023019
Community Expert
Community Expert
June 14, 2021

Great! You're welcome!