11.19.07
Flex 2 / Flash CS3 ActionScript Error #1013
ActionScript Error #1013: The private attribute may be used only on class property definitions.
Description:
This ActionScript Error justs means that you have used the access control modifier 'private' in the wrong spot. There are four access control modifiers - public, private, internal, and protected. Each of these specify how the method or variable is accessed. Each access control modifier has it's own error but they all mean the same thing. Access control modifiers need to be used in the right place. The 'internal' and 'public' can only be used inside a 'package' and 'private' and 'protected' can only be used on classes. AS3 error 1013 can also be caused if you misplace a method identifier like ':void'
Fix:
Make sure to only use the 'private' access control modifier to define a method or variable within the class itself and not within a method(function).
Bad Code 1:
package{public class MySize {public function Connection():void{private var size:uint = 40;trace(size);}}}
Good Code 1:
package{public class MySize {private var size:uint = 40;public function Connection():void{trace(size);}}}
or
package{public class MySize {public function Connection():void{var size:uint = 40;trace(size);}}}
Bad Code 2:
package{public class MySize {public function Connection():void{someFunction():void;} private function someFunction():void{var size:uint = 40;trace(size);}}}
Good Code 2:
package{public class MySize {public function Connection():void{someFunction();} private function someFunction():void{var size:uint = 40;trace(size);}}}
Related ActionScript Errors - AS3 Error 1114, AS3 Error 1115 , AS3 Error 1150
This ActionScript Error is a quick one. I hope this helps you solve it.
As always Happy Flashing
curtismorley.com » Flex 2 / Flash CS3 ActionScript Error #1150 said,
November 21, 2007 at 5:20 am
[...] ActionScript Errors - AS3 Error 1013, AS3 Error 1114, AS3 Error [...]
curtismorley.com » Flex 2 / Flash CS3 ActionScript Error #1115 said,
November 21, 2007 at 5:29 am
[...] ActionScript Errors - AS3 Error 1013, AS3 Error 1114, AS3 Error 1115 , AS3 Error 1150 This ActionScript Error is a quick one. I hope [...]
curtismorley.com » Flex 2 / Flash CS3 ActionScript Error #1114 said,
November 21, 2007 at 5:30 am
[...] ActionScript Errors - AS3 Error 1013, AS3 Error 1115 , AS3 Error [...]
Gary said,
December 12, 2007 at 8:29 pm
My code looks very similar to yours but i still cant seem to find the error
here is a sample of the code
private function dispatchColorPicked(mouseEvent:MouseEvent):void
{
can you help me out
Curtis J. Morley said,
December 18, 2007 at 5:35 pm
Gary,
Sorry the comment field sometimes chops off the code. Could you try including the rest of the code especially the package, constructor and curly braces. Check to make sure that you don’t have any rogue braces that are misplaced and that this function is nested inside the Class.
Let me know how it works for you and as always Happy Flashing.
Curtis
curtismorley.com » Flex / Flash ActionScript Error #1095 said,
January 18, 2008 at 4:01 pm
[...] ActionScript Errors - AS3 Error 1094, AS3 Error [...]
web design blog said,
August 20, 2008 at 2:27 pm
In my case the problem was an if statement…
it was something like
if (a != b) ;
trace(a-b);
}
just a syntax error after the conditional… hope it helps