Error #1078: Label must be a simple identifier.
Description:
The main reason you will get this ActionScript error comes because of mistyping a colon. You can get AS3 Error 1078 by putting a a colon at the end of a line instead of a semicolon. You can get it by trying to ‘Type’ an object without the ‘var’ keyword, and my personal favorite – If you are in Flash writing a Class and hit the quick keys esc >> t >> r to get a trace(); statement you will get trace():void; instead.
Fix 1:
This error can be resolved by correctly typing a semicolon.
Bad Code1
myText.border = false:
Good Code1 :
myText.border = false;
Fix 2:
This can be resolved by using the keyword var. (The bad code example here is really bad code)
Bad Code 2:
this.box:MovieClip = new MovieClip();
Good Code 2:
var box:MovieClip = new MovieClip();
Fix 3:
Delete the silly extra stuff that Flash puts in there for you. If you have the bad code as shown below you will most likely get another error like 1083. Just fix the first and the second will also be resolved.
Bad Code 3:
trace():void
Good Code 3:
trace();
And that is how you solve ActionScript Error #1078
Happy Flashing
thanks very much, i had typed the colon…
sebastian
I can’t imagine life without google and posts like these.
Thanks a lot!
good that you come out first for this search 🙂
thanks
Thanks for posting this, it saved my time.
Here’s one:
Bad:
private getObject():Object
{
return
{
attrib1:objA.stuff,
attrib2:objB.stuff
};
}
Good:
private getObject():Object
{
var obj:Object =
{
attrib1:objA.stuff,
attrib2:objB.stuff
};
return obj;
}
Great post – thanks!
Thank you, Curtis!
I also had colon at the end and lost some time before finding your article.
Good post solved my problem
@Ryan: take the “:void” off the end of that line and replace it with a semicolon… you should have the declaration of the event listener like this:
splat_mc.addEventListener(MouseEvent.RIGHT_CLICK, splatter);
then the function definition like this:
function splatter(evt:MouseEvent):void
{
// event handler stuff here
}
Hey Curtis awesome helpful blog! I have an error I hope you can help me with. I have watched many tutorials and I’m starting to get the hang of AS 3 but I’m getting an error 1078 that I can’t explain. I would be real grateful if you took a look. I have a variable named splat_mc which is a movieclip. I have a function called splatter. I’m not sure what I’m doing wrong. Any help would be appreciated thanks!!!
splat_mc.addEventListener(MouseEvent.RIGHT_CLICK, splatter):void
I was also getting “1078: Label must be a simple identifier.
Thanks, this helped me find my problem. My issue was that I had mistyped a function declaration like this:
// correctly defined previous function…
addEventListener(…):void; // I accidentally put void here instead of the return type in the next function signature
} // end previous function
private function nextFunction() { // This line was missing the return type three lines above
// code
}
When I moved my misplaced code the 1078 error went away.
u rock dude….. i just had the same trouble
DATAGRID_DebitorenAuswahl.y = TEXTINPUT_Debitor_von.y + TEXTINPUT_Debitor_von.height:
just won’t compile with strange message…
ur blog saved our souls.
greetings from outa space
I’ve still got the 1078 error.
bad code:
function addParticle2(e.Event)
it tells me that “Label must be a simple identifier”
I do not not know why it does this because it checks out with:
function addParticle(e.Event)
and I’ve created both Particle and Particle two as movie clips, exporting to action script and in first name. I’ve named 1 “dot” and the other “dot2”. I also appropriately defined dot and dot2 as variables. perhaps maybe you can tell me whats wrong with the code.
thanks,
Mike
Cheers,
stupid semi-colon mistake, thanks to this page and a quick Google search, am back to work 😛
I’m getting the error when i’m trying to TYPE a variable within an object or array:
var myVar:Array = new Array();
myVar[‘aNumber’]:Number = 0;
Throws: 1078: Label must be a simple identifier.
Any ideas why?
thanks,
Tim
Austin and Brart,
Glad that this helped. The semicolon is often hard to recognize and therefore difficult to see when troubleshooting. Good example Brart.
Thanks,
Curtis J. Morley
It also give this error if:
var box:Menu1 = Menu1;
addChild(box):
Good code:
var box:Menu1 = Menu1;
addChild(box);
THe difference:
: -> ;
Brart
This has not helped me yet. I learned flash in actionscript 1.0 so naturally i’m getting all kinds of errors. This is my latest one. Error 1078 every time I just try to reference a movie clip. What am I doing wrong? Here is some examples of code that produced error:
(Actually, as I just went to go copy the code, I found that I did put in a colon! AHHH.) Thank you!
hahaha…
Pingback: curtismorley.com » Search Engine Optimization Example
Thanks, that solved my problem, what a mysterious error 🙂
Pingback: curtismorley.com » Added new info to ActionScript Error #1078
Mihai,
Thanks for the comment. This is another good example of when you will get this ActionScript Compile error. It is due to scope.
Bad Code:
this.box:MovieClip = new MovieClip();
Good Code:
var box:MovieClip = new MovieClip();
Hope this helps and Happy Flashing
Curtis J. Morley
I also got the error because I wrote this (without realising, of course):
this._box:VBox = new VBox();
…strange that the error isn’t a bit more descriptive of what the problem actually is.