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…
on(rollOver){
contactMenu.play();
}
Why this does not work?
This message can also appear when you have an extra closing brace.
Chad Upton
http://flex.chadupton.com
Thanks for the update Chad!
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.
I have this problem with code:
on(relase) {
getURL(clickTag, “_blank”)
}
Why???
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?
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();
}
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.
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!
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?
@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]
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);
}
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”)
}
@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).
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?
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.
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?
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.
This should working in AS3:
this.addEventListener(MouseEvent.ROLL_OVER, gotoS1);
function gotoS1(event:MouseEvent):void
{
gotoAndPlay(“S1″);
}
=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
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();
}
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
on (press){
gotoAndPlay(frame);
}
wahy is not work?
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
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;
{
@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
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.
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…
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”);
}
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!
on (rollOver) {
gotoAndStop (“open”);
}
where is the error ?
i am using action script 3.0
plz reply
its showing , 1087 Syntax error: extra characters found after end of program.
onClipEvent (load) {
velocidade = 5;
}
onClipEvent (mouseDown) {
endX = _root._xmouse;
endY = _root._ymouse;
}
onClipEvent (enterFrame) {
_x += (endX-_x)/velocidade;
_y += (endY-_y)/velocidade;
}
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.
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
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
THANK YOU MESSOR IT WORKED PERFECTLY!!!!
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″);
}
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?
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
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.
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’);
}
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….
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”);
}
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
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.
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.
on (release) {
gotoAndPlay(2);
}
.
Why doesn’t it work? please help.
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
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?