Description of Error
You have a method marked override, but there’s no visible method with that name in the superclass.
Adobe’s Official Writeup
No commentary offered.
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 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 and not be marked private. If you extend MovieClip and attempt to create a method called test() and mark it override, you will generate this 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
If you’re attempting to override a super class’s method, make sure you have the name right. AS3 is case sensitive, so override function tostring() will throw a 1020, while override function toString() won’t.
Also, remember that any method marked private is invisible outside of its own class. You can’t override private methods because you don’t have access to them – so if you want the child class to redefine the functionality of the parent class’s private methods, you can just define new private methods. There’s no need to override.
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
Most Recent Comments