Error 1013: The private attribute may be used only on class property definitions.

Error 1013: The private attribute may be used only on class property definitions.
Error 1150: The protected attribute can only be used on class property definitions

Some people do not enclose their if statements with curly braces in cases like this:

	// original code
	if (renderAtStartup)
		callLater(render);
	
	// incorrect - notice missing opening curly brace
	if (renderAtStartup)
		callLater(render);
	}

	// correct
	if (renderAtStartup) {
		callLater(render);
	}

I always add opening and closing braces for several reasons. One, for readability and two because tab and spaces do not match from system to system. In my case a change was made and a closing brace was placed at the end of the statement but not at the beginning. The error is generated because the opening curly brace is missing.

This causes the class to be terminated early and then this causes all the functions and properties to be located outside of the class.

This entry was posted in AIR, Errors, Flex. Bookmark the permalink.

8 Responses to Error 1013: The private attribute may be used only on class property definitions.

  1. Mat says:

    I Googl’ed the error number I had in Flex Builder, found your article and solved it in less than one minute.

    —-> Thanks a lot.

  2. Raakhee says:

    I have tried that….and i luckly had the curly braces open and close..i am still getting that error…cant figure out WHY :(

    here is my code
    private function animate(e:Event):void
    {
    e.target.alpha -= 0.05;
    //if lightBall is no longer visible, remove it
    if (e.target.alpha

  3. Aless says:

    Thanks a lot… adobe compiler is the worst compiler ever made, it cannot handle some basic human error.

  4. schrst says:

    had the same error, thanks to you i was able to solve it wirhin one minute, thanks a lot :)

    strange error though, i am used to write it the “lazy” way…

  5. Erik says:

    Same for me, solve it in 10 seconds after seing this. Thank you.

  6. Found the stray bracket and the problem was fixed right away. Thanks for the tip.

  7. fatih says:

    Flash auto-format can cause this problem too!! It generated a wrong bracket in my case !

    Thanks for the post.

Leave a Reply

Your email address will not be published. Required fields are marked *

Wrap your code before posting! Click the links below:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="">