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

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

Problem:
A block of code may be missing an opening brace ({).

Example:

if (!iconParent) 
	iconParent = Application.application;
}

Notice there is no opening brace after “(!iconParent)”.

Please reply in the comments below if this helped you or not. You can also use the Error Lookup Tool to look up Flex compiler or runtime errors. more info…

This entry was posted in Errors, Flash, Flex. Bookmark the permalink.

59 Responses to 1087: Syntax error: extra characters found after end of program.

  1. shmizlicka says:

    on(rollOver){
    contactMenu.play();
    }

    Why this does not work?

  2. Chad Upton says:

    This message can also appear when you have an extra closing brace.

    Chad Upton
    http://flex.chadupton.com

  3. Judah says:

    Thanks for the update Chad!

  4. Adam says:

    i keep getting the same message “1087:syntax error: extra characters found after end of program” on this action:

    on(release){
    gotoAndStop(“SectionOne”);

    }

    from what i can tell there isn’t anything wrong with it.

    any suggestions?

    A.

  5. Sina says:

    I have this problem with code:

    on(relase) {
    getURL(clickTag, “_blank”)
    }

    Why???

  6. Curtis says:

    I’m having exactly the same problem as Sina and cannot figure out what the hell is wrong with it. I’m using exactly the same code as she is. Any ideas?

  7. Judah says:

    In each of the posted examples it appears there is no quotes around the event name,

    on(rollOver){
    contactMenu.play();
    }

    //should be
    on(“rollOver”){
    contactMenu.play();
    }

  8. Curtis says:

    I solved my problem, my project was set to compile with AS3 rather than AS2 and I was trying to use AS2 script syntax in AS3 which has had some significant changes made to it. This may help Sina with the problem that she was experiencing as it solved mine.

  9. Di says:

    I also encountered this problem when I try to switch from AS2 to AS3, here is the code,

    [as]
    onClipEvent (load) {
    total = _root.getBytesTotal();
    }
    onClipEvent (enterFrame) {
    loaded = _root.getBytesLoaded();
    percent = int(loaded/total*100);
    text = percent+”%”;
    gotoAndStop(percent);
    if (loaded == total) {
    _root.gotoAndPlay(2);
    }
    }
    [/as]

    Can anyone please help??? Thanks so much!

  10. trent says:

    mine says that, even though there is an opening brace after the beginning:

    [as]
    onClipEvent(“1″){
    if(Key.isDown(Key.RIGHT)){
    this._x+=5;
    this.gotoAndStop(“1:character”);
    [/as]
    can anyone help me?

  11. Judah says:

    @Di – should you put quotes around your parameter?

    // incorrect
    onClipEvent (enterFrame) {

    // correct
    onClipEvent (“enterFrame”) {

    @trent – you have opening braces but it looks like you are missing the closing braces. you may also have to specify an event rather than a number? ie “onClick” or “click” instead of “1″

    [as]
    // correct
    onClipEvent(“1″){
    if(Key.isDown(Key.RIGHT)){
    this._x+=5;
    this.gotoAndStop(“1:character”);
    }
    }
    [/as]

  12. JH says:

    I am trying to control a movie clip from the root of a movie and am getting the same error in the following code. Is there anybody that can help me?

    mc_slides.ifFrameLoaded (35) {
    mc_slides.gotoAndPlay(3);
    }

  13. HH says:

    I’m trying to figure out how to link the site together and I have found out how but constantly im gettting this error message saying that there are extra characters but the code is exactly like it was in the tutorial can someone please assist me.

    on(“release”) {
    getURL(“http://www.crystalicecreations.com”)
    }

  14. Judah says:

    @HH – I’m not sure what the error might be but retype the code above. if you have “formated” quotes then that will mess it up. formated quotes are the kind you find in word processing programs. they are the special “begin” quote that faces one direction and the special “end” quote that faces the other direction. software doesn’t like that and you frequently run into errors when you copy code from book examples. the other thing that may be going on is that nothing is wrong with this code but you have an error somewhere else. remove this code and see if the error goes away then add it back in (retype it or copy and paste it into notepad and then copy and paste it into flash).

  15. HH says:

    ok how would i be able to change formatted quotes?
    and the copy and pasting method did not work.
    is there any other way i could contact you via aim email?

  16. JoeWillie says:

    Yup, same here. The ActionScript 3.0 was hanging me up to start. Just switched to ActionScript 2.0 and the code I was using worked fine. I’m off to locate a good 3.0 book as the Adobe help (as usual) stinks.

  17. Zenous says:

    I get the same:
    on (“release”){getURL(“http://site.com”, “_blank”);}
    brings 1087 error, both in AS2 and AS3 – does anybody know where it comes from?

  18. RikMusik says:

    This is not a solution but another cause which may help on the trail to the resolution.

    I have been encountering this error quite a bit (and no, there are no extra characters at the end of the program ).

    I’ve found this occurs using Auto format and I suspect the issue is with copy & pasted code. I have an AS file that compiles and runs perfectly in AS3. when I hit auto format, it gives me that error when I try to run it.

    I suspect the issue is foreign characters when copying & pasting and/or its related to the auto format.

    I ran in to the character problems when learning Java. some microsoft characters look normal when pasted but are not what they seem.

    Best advice, re-type everything rather than pasting.

  19. messor says:

    This should working in AS3:

    this.addEventListener(MouseEvent.ROLL_OVER, gotoS1);

    function gotoS1(event:MouseEvent):void
    {
    gotoAndPlay(“S1″);
    }

  20. Jose says:

    =1087: Syntax error: extra characters found after end of program

    ANSWER= your document is in actionScript 3.0 and you are typing actionScript 2.0 or viceversa

  21. Sigrid says:

    I’m a beginner and can’t figure out what’s wrong, I also get the :
    1087: Syntax error: extra characters found after end of program.
    I’m using 3.0

    Can anyone see anything wrong?

    stop();
    }function on Next click (MouseEvent):void {
    if (currentFrame == totalFrames) {
    gotoAndStop(1);
    } else {
    nextFrame();
    }
    }function on Previous click (MouseEvent):void {
    if (currentFrame == 1) {
    gotoAndStop(totalFrames);
    } else {
    prevFrame();
    }

  22. Isisescul says:

    looks like all ya have to do is to put the { } on different lines and delete the spaces. Worked 4 me. Example:

    onClipEvent (load)
    {
    total = _root.getBytesTotal();
    }
    onClipEvent (“enterFrame”)
    {
    loaded = _root.getBytesLoaded();
    percent = int(loaded/total*100);
    text = percent+”%”;
    gotoAndStop(percent);
    if (loaded == total) {
    _root.gotoAndPlay(2);
    }

    }

    Isisescul

  23. ala says:

    on (press){
    gotoAndPlay(frame);
    }
    wahy is not work?

  24. enFuego says:

    ADOBE FLASH CS3

    1087: Syntax error: extra characters found after end of program. – onClipEvent (load) {

    onClipEvent (load) {
    this.onRollOver = function() {
    this.onEnterFrame = function() {
    if (this._currentframe1) {this.prevFrame();} else {delete this.onEnterFrame;}};};
    }

    help? :F

  25. Rap says:

    Where is the error?

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

    onClipEvent(“enterFrame”){
    if(Key.isDown(Key.RIGHT)){
    this._x += 12;
    this.rotation += 12;
    }
    var x:String;
    {

  26. Judah says:

    @Rap – the last character should be “}” instead of “{”

    @enFuego – i think you have an extra “}” at the end of your code. try indenting your code and make sure the number of opening braces match the number of closing braces

  27. Pablo says:

    I get the same error, BUT, I realize that I was typing in AS2, and this IS AS3.

    Just type the following:

    this.addEventListener(MouseEvent.ROLL_OVER, gotoOver);

    function gotoOver(event:MouseEvent):void
    {
    gotoAndPlay(“Over”);
    }

    i.e.

  28. Bram says:

    flash.system.fscommand(“trapallkeys”, “true”);
    onClipEvent(“keyDown”) {
    if(Keyboard.getCode() == Keyboard.ESCAPE) {
    flash.system.fscommand(“quit”);
    }
    }

    I somehow HAVe to use AS3.0 and I am just a noob so please, help me. getting same error on the line “onClipEvent(“keyDown”)”
    also tried without quotes…

  29. Lauren says:

    I’m using the following code using flash vol. 9 actionscript 2 and I keep getting a compiler error. Any ideas???

    on (release) {
    getURL(clickTAG,”_blank”);
    }

  30. Johy says:

    I am also getting this error?
    1087 Syntax error: extra characters found after end of program.

    This is my code, i am using AS3

    stop();
    Symbol 2.addEventListener(MouseEvent.CLICK,onMouseClick);
    function onMouseClick(event:MouseEvent):void {
    var request:URLRequest = new URLRequest(“http://www.google.com/”);
    navigateToURL(request, “_self”);
    }

    Please help, Any help much appreciated. Thanks!

  31. mazhar says:

    on (rollOver) {
    gotoAndStop (“open”);
    }

    where is the error ?

    i am using action script 3.0
    plz reply

  32. mazhar says:

    its showing , 1087 Syntax error: extra characters found after end of program.

  33. John says:

    onClipEvent (load) {
    velocidade = 5;
    }
    onClipEvent (mouseDown) {
    endX = _root._xmouse;
    endY = _root._ymouse;
    }
    onClipEvent (enterFrame) {
    _x += (endX-_x)/velocidade;
    _y += (endY-_y)/velocidade;
    }

  34. Neorg says:

    SOLVED

    I Solved the problem by placing the curly bracket at the beginning of the second line instead of his original place behind the “)”

    I changed this:
    ———————–
    on (release){
    getURL(clickTag,”_blank”);
    }

    in to this:
    ————————–
    on (release)
    {
    getURL(clickTag,”_blank”);
    }

    Now the error is gone.

  35. Nick says:

    onClipEvent(load)
    (speed=5)
    onClipEvent(enterFrame){
    if(Key.isDown(Key.RIGHT))
    {this._x+=speed}
    if(Key.isDown(Key.LEFT))
    {this._x-=speed}
    if(Key.isDown(Key.UP))
    {this._y-=speed}
    if(Key.isDown(Key.DOWN))
    {this._y+=speed}}

    Hi everyone I have just started learning AS3 and this piece of code has been giving me the 1087 syntax error.

    Please help

  36. loro says:

    Hey I am did a drop down menu in flash cs4 and I added this code to the movie clip

    on (rollOver) {
    this.gotoAndPlay (2) ;
    }
    on (rollOut) {
    this.gotoAndStop (1) ;
    }

    but it keeps on giving me the syntax error what am i doing wrong here?

    Thanks

  37. bob says:

    THANK YOU MESSOR IT WORKED PERFECTLY!!!!

  38. Mark says:

    This doesn’t work, and I don’t know why… it’s simple..
    [1087: Syntax error: extra characters found after end of program.]

    stop();

    this.btn1.addEventListener(MouseEvent.CLICK,ShowLBL1);
    function ShowLBL1(event:MouseEvent):void {
    gotoAndPlay(“lbl1″);
    }

    this.btn2.addEventListener(MouseEvent.CLICK,ShowLBL2);
    function ShowLBL2(event:MouseEvent):void {
    gotoAndPlay(“lbl2″);
    }

    this.btn3.addEventListener(MouseEvent.CLICK,ShowLBL3);
    function ShowLBL3(event:MouseEvent):void {
    gotoAndPlay(“lbl3″);
    }

    this.btn4.addEventListener(MouseEvent.CLICK,ShowLBL4);
    function ShowLBL4(event:MouseEvent):void {
    gotoAndPlay(“lbl4″);
    }

    this.btn5.addEventListener(MouseEvent.CLICK,ShowLBL5);
    function ShowLBL5(event:MouseEvent):void {
    gotoAndPlay(“lbl5″);
    }

    this.btn6.addEventListener(MouseEvent.CLICK,ShowLBL6);
    function ShowLBL6(event:MouseEvent):void {
    gotoAndPlay(“lbl6″);
    }

    this.btn7.addEventListener(MouseEvent.CLICK,ShowLBL7);
    function ShowLBL7(event:MouseEvent):void {
    gotoAndPlay(“lbl7″);
    }

    this.btn8.addEventListener(MouseEvent.CLICK,ShowLBL8);
    function ShowLBL8(event:MouseEvent):void {
    gotoAndPlay(“lbl8″);
    }

    this.btn9.addEventListener(MouseEvent.CLICK,ShowLBL9);
    function ShowLBL9(event:MouseEvent):void {
    gotoAndPlay(“lbl9″);
    }

    this.btn10.addEventListener(MouseEvent.CLICK,ShowLBL10);
    function ShowLBL10(event:MouseEvent):void {
    gotoAndPlay(“lbl10″);
    }

    this.btn11.addEventListener(MouseEvent.CLICK,ShowLBL11);
    function ShowLBL11(event:MouseEvent):void {
    gotoAndPlay(“lbl11″);
    }

    this.btn12.addEventListener(MouseEvent.CLICK,ShowLBL12);
    function ShowLBL12(event:MouseEvent):void {
    gotoAndPlay(“lbl12″);
    }

  39. Name says:

    onClipEvent (enterFrame) {
    if(Key.isDown(Key.LEFT)){
    this._x -= speed;
    }
    if (Key.isDown(Key.RIGHT)){
    this._x += speed;
    }
    if(this._x>376){
    this._x += 0; }
    if(this._x<0){
    this._x += 376;
    }
    }

    why is he showing me the error?

  40. Bruce says:

    onClipEvent(enterFrame){
    this._x=root._xmouse;
    this._y=root._ymouse;
    }

    keep getting the

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

    error, cant see anything wrong, tried putting each speech marks around enter flame, complied it in as3 and as2 and vice versa :S

  41. China says:

    i’m a noob when it comes to actionscripting so please be patient.

    on(release) {
    getURL(“aboutme.swf”,”_new”,”GET”);
    }

    this may be easy for you but for some reason the code won’t work. I’m using flash cs4 and actionscripting 3.0. help would be appreciated.

  42. Akeam says:

    Ive put this code in for a drop down menu i made. When you roll over the first bit of text another line is supposed to drop down but i keep on getting this error 1087.
    on (“rollOver”){
    gotoAndStop (‘OPEN’);
    }

  43. carmen says:

    so, i found out after hours:
    if you use the codes that you know (as2), and just in the publish settings you put as2 instead of as3, it’ll all work….

  44. Ben Francis says:

    I’m not sure if anyone will still even be following this thread, but in answer to a lot of the previous ‘it looks fine, why is it still not working’, I believe it is due to formatting, with spaces between words and putting {}s on new lines etc. I found that this code wouldn’t work:

    on(release) {
    getURL(“http://myurl.com”);
    }

    …but this could would:

    on (release)
    {
    getURL(“http://myurl.com”);
    }

  45. Mark says:

    thank you for taking the time to read about my problem.
    the problem is when i write onClipEvent (load){
    moveSpeed=10;
    } I get a syntax error: extra characters onClipevent(load)
    Why
    if possible can you explain what am i doing wrong? and how not to get this syntax error
    thank you for your time
    Mark marksplase@yahoo.com

  46. dreamindly says:

    I pressed enter after the first { to make it appear on its own line.
    I changed from AS 3 to AS 2 in publish settings, too.

    and the damn thing disappeared. thank you guys for the comments.

  47. Magnus says:

    ok so im using actionscript 3, and im using this code which doesnt work.

    onClipEvent (load) {
    this.x = 0 + Math.random()*575;
    this.y = -50 + Math.random()*425;
    this._alpha = Math.random()*100;
    var size;
    size = Math.random()*100
    if (size>=50&&size<=100) {
    this._xscale = size;
    this._yscale = size;
    }
    else {
    this._xscale = 90;
    this._yscale = 90;
    }
    }

    i get the syntax error 1087

    what i know is that this code is meant for as2 (onClipEvent (load) {), and i can just change to that to fix it, however, im at school and we're only suppose to use as3, how can i then fix it? im sure there is a new way to write this code in as3, i just dont know how.

  48. Will says:

    on (release) {
    gotoAndPlay(2);
    }
    .
    Why doesn’t it work? please help.

  49. caybob says:

    hey guys, need some help this code is messing up on me

    on(release){
    _root.but.play();
    buttoninstince._visable=false;
    }
    it comes up with 1087: Syntax error: extra characters found after end of program. error

  50. Hi, I’ve never seen that error message before and after a bit of a google around I couldn’t find anyone with a solution to it. Maybe you’ve accidentally used some odd character in there, try copying and pasting this lot instead:

    on(Release)
    {
    getURL(“http://www.saokim.com.vn”, “_self”);
    }

    Do you not get the error if you dont put the code on the button at all?

Leave a Reply

Your email address will not be published. Required fields are marked *

Wrap your code before posting! Click the links below:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="">