Ryan Fuhrman Ryan Fuhrman - 4 months ago 20
ActionScript Question

ActionScript 3.0 - [Error] expecting identifier before 10128

So I've been working on a flash game with a friend of mine and we encountered a error that we have been stuck on since yesterday.

The Errors:

Line 5 1084: Syntax error: expecting identifier before 10128
Line 5 1084: Syntax error: expecting identifier before 10129
Line 5 1084: Syntax error: expecting identifier before 10200


Here is the code for the 3 files

10128.as

package
{
import flash.display.*;

public dynamic class 10128 extends MovieClip //Line 5
{
public var back:Object;
}
}


10129.as

package
{
import flash.display.*;

public dynamic class 10129 extends MovieClip //Line 5
{
public var back:MovieClip;
}
}


10200.as

package
{
import flash.display.*;

public dynamic class 10200 extends MovieClip //Line 5
{

}
}


I've looked everywhere and I did view the other posts on this site regarding the same issue but It still didn't work. If anybody knows what's wrong I would appreciate if someone could help me out here.

Answer

Class name should start with uppercase character. (updated "must" to "should")
Class name starting with lowercase character might also works, but starting with numeric character doesn't work.

See this link http://wiki.opensemanticframework.org/index.php/AS3_Coding_Standards

Currently, your class name start with numeric character.
Change your file name and class name, for example...

Test10128.as

package 
{ 
    import flash.display.*;

    public dynamic class Test10128 extends MovieClip //Line 5
    {
        public var back:Object;
    }
}

Test10129.as

package 
{
    import flash.display.*;

    public dynamic class Test10129 extends MovieClip //Line 5
    {
        public var back:MovieClip;
    }
}

Test10200.as

package 
{
    import flash.display.*;

    public dynamic class Test10200 extends MovieClip //Line 5
    {

    }
}
Comments