Search code examples
javascriptactionscript-3flash-cs4identifier

Flash CS4 Error 1084: Expecting Identifier before Var


I have an identifier, 'this', before my 'var' function. However, it still tells me that I need an identifier before my 'var' function. Below is my code:

this.var mc=new MovieClip();
addChild(mc)="myButton1", this.DisplayOBjectContainer.numChildren());
myButton1.createEmptyMovieClip("buttonBkg", myButton1.getNextHighestDepth());

myButton1.buttonBkg.lineStyle(0, 0x820F26, 60, true, "none", "square", "round");
myButton1.buttonBkg.lineTo(120, 0);
myButton1.buttonBkg.lineTo(120, 30);
myButton1.buttonBkg.lineTo(0, 30);
myButton1.buttonBkg.lineTo(0, 0);

Any help is much appreciated, thanks!


Solution

  • Your syntax is invalid.

    The var keyword is only used to declare local variables.
    To assign an object property, you use regular assignment, like this:

    this.mc=new MovieClip();