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
[as]
myText.border = false:
[/as]
Good Code1 :
[as]
myText.border = false;
[/as]
Fix 2:
This can be resolved by using the keyword var. (The bad code example here is really bad code)

Bad Code 2:
[as]
this.box:MovieClip = new MovieClip();
[/as]
Good Code 2:
[as]
var box:MovieClip = new MovieClip();
[/as]
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:
[as]
trace():void
[/as]
Good Code 3:
[as]
trace();
[/as]

18 thoughts on “1078 Label must be a simple identifier.

  1. 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.

    Like

  2. 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

    Like

  3. 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…

    Like

  4. It also give this error if:

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

    Good code:

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

    THe difference:

    : -> ;

    Brart

    Like

  5. 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

    Like

  6. var i:uint;
    var picArrLdr:Array=new Array(pic1ldr,pic2ldr);
    for (i=1;i<5;i++){
    picArrLdr[i]:Loader = new Loader();
    }

    error:
    1078: Label must be a simple identifier.

    help

    Like

  7. @andrew – it looks like you are specifying the array content type (as Loader). as of as3 you can’t type variable content like that. so this line:

    picArrLdr[i]:Loader = new Loader();

    should be:

    picArrLdr[i] = new Loader();

    if you want later you can type cast it like this to get code hinting:

    Loader(picArrLdr[i])

    Like

  8. Thanks for this… here is the scenario that caused it for me…

    * Had a separate file (flatdata.as) that just declared some arrayCollections. I forgot to put commas after each element in one of my arrays and got the error.

    private var flat1:ArrayCollection = new ArrayCollection([
    {TransID:1256, AppID:20001577, FIID:7545, CreateDate:”10/05/2009″, Successful:”Y”, Hidden:”N”}
    {TransID:1257, AppID:20001577, FIID:7545, CreateDate:”10/04/2009″, Successful:”N”, Hidden:”Y”}
    {TransID:1259, AppID:20001577, FIID:7545, CreateDate:”10/04/2009″, Successful:”N”, Hidden:”Y”}
    {TransID:1263, AppID:20001577, FIID:7545, CreateDate:”10/02/2009″, Successful:”N”, Hidden:”Y”}
    ]);

    Like

  9. Thanks for posting this, it helped me find the real error. This will also come up if you accidentally use “new” instead of “var”. As in:

    new variableName:Class = new Class();

    I’m not saying I did that, I’m just speculating… 🙂

    So that makes me think you will get this error with many misuses of the “new” keyword.

    Like

  10. Im working on a program my code line looks like this.

    UIComponentGlobals.layoutManager.mx.managers:ILayoutManager::invalidateDisplayList(this);

    I dont understand why im getting this error.

    Like

  11. @Greg
    You may need to include the mx_internal namespace into your class. Similar to,

    import mx.core.mx_internal;
    use namespace mx_internal;

    Like

  12. Heres the part of the code im having trouble with.

    public function invalidateDisplayList() : void
    {
    if (!invalidateDisplayListFlag)
    {
    invalidateDisplayListFlag = true;
    if (isOnDisplayList() && UIComponentGlobals.layoutManageruse)
    {
    UIComponentGlobals.layoutManager.mx.managers:ILayoutManager::invalidateDisplayList(this)
    }
    }
    return;
    }// end function

    Like

    1. I think the issue is this line,
      UIComponentGlobals.layoutManager.mx.managers:ILayoutManager::invalidateDisplayList

      You are referencing an interface, “ILayoutManager”, rather than the instance “LayoutManager”.

      At application startup, a single instance of the LayoutManager is created and stored in the UIComponent.layoutManager property. All components are expected to use that instance. If you do not have access to the UIComponent object, you can also access the LayoutManager using the static LayoutManager.getInstance() method.

      Like

  13. Hello,
    Thanks Admin for saving my few hours finding why the error is occuring..{as3 1078 error}
    Have a great day..
    The solution I like pasted below.
    =============
    picArrLdr[i]:Loader = new Loader();

    should be:

    picArrLdr[i] = new Loader();

    Like

Leave a reply to Andrew Cancel reply