06.19.07

Flash CS3 / Flex 2 AS3 Error #1078

Posted in Flash, Flex, errors at 5:43 pm by Curtis J. Morley

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

9 Comments »

  1. Mihai said,

    July 13, 2007 at 1:29 pm

    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.

  2. Curtis J. Morley said,

    July 13, 2007 at 9:49 pm

    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

  3. curtismorley.com » Added new info to ActionScript Error #1078 said,

    August 22, 2007 at 7:48 pm

    [...] ActionScript 3 Error #1078 [...]

  4. Andrew said,

    May 27, 2008 at 11:31 am

    Thanks, that solved my problem, what a mysterious error :)

  5. curtismorley.com » Search Engine Optimization Example said,

    June 2, 2008 at 4:50 pm

    [...] AS3 Error 1083 - #1,2 hit on Google [...]

  6. austin said,

    June 24, 2008 at 7:22 pm

    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…

  7. Brart said,

    June 25, 2008 at 6:30 am

    It also give this error if:

    var box:Menu1 = Menu1;
    addChild(box):

    Good code:

    var box:Menu1 = Menu1;
    addChild(box);

    THe difference:

    : -> ;

    Brart

  8. Curtis J. Morley said,

    June 26, 2008 at 12:41 pm

    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

  9. tim said,

    October 3, 2008 at 12:13 am

    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

Leave a Comment