1010: The override attribute may be used only on class property definitions


Description of Error

You’re attempting to override a method or property that’s not at the class level. For instance, you will get this error if you attempt to override a function nested within a class method.

Adobe’s Official Writeup

You cannot use the override keyword within a function block.
(Adobe Error Reference)

Cause of the Error

The override keyword allows you to redefine a method or property of a parent class. For instance, you may override the toString() method of MovieClip if you’re extending MovieClip and want to trace out a more detailed description of your class. There are several requirements to using the override keyword:

1) You have to be overriding at the class level. You cannot override a function block that’s nested within a class method, nor can you override a function block of timeline code. Otherwise, you generate this error (1010: The override attribute may only be used on class property definitions).

2) The method you’re attempting to override must exist within the parent class. If you extend MovieClip and attempt to create a method called test() and mark it override, you will generate error 1020: Method marked override must override another method.

3) The method you’re attempting to override must not be marked final. If it is you’ll generate error 1025: Cannot redefine a final method.

4) Finally, your override method must match the parameters and return type of the method it’s overriding – including access specifiers and namespace. Otherwise you’ll generate error 1023: Incompatible override.

Solutions to the Error

Solve error 1010 by making sure you’re not attempting to override a function block. If you’re marking a nested function with override then something is wrong anyway – so delete the override keyword altogether, and at least you won’t be getting this error any more.

Other Articles About This Error

If you’ve read a useful writeup of this issue elsewhere on the internet, leave a comment and I’ll add it to this list.



If you found the content of this post useful, please consider clicking the google +1 button to help others find this as well.

If you found it very helpful, please consider throwing a few bits of bitcoin my way! Send to: 1PbUCtn5k3G89rSGTuT6BfkXSekSkjjfKr