1023: Incompatible Override


Description of Error

When overriding a method (replacing the super class’s method with your own of the same name) you are required to match input parameters and types, return type, access specifier and namespace exactly. If you don’t you’ll get this error.

Adobe’s Official Writeup

A function marked override must exactly match the parameter and return type declaration of the function it is overriding. It must have the same number of parameters, each of the same type, and declare the same return type. If any of the parameters are optional, that must match as well. Both functions must use the same access specifier (public, private, and so on) or namespace attribute as well.
(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 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 this error (1023: Incompatible override).

Solutions to the Error

If you’re overriding one of the super class’s methods, take a look at the access specifier (public, internal, protected) and the namespace, the input parameters and the return type. Make sure that your override matches the original method exactly in all of these.

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



  1. #1 by goJohnnyGo on December 7th, 2010

    Omg, went over my code a zillion times can couldn’t figure out why I was getting this error. I read your description and realized I didn’t specify “void” as my return type. D’oh!

  2. #2 by myk on December 7th, 2010

    Glad it helped! Something that helps to avoid these kinds of problems is using an IDE that does autocomplete for overrides. Using Flash Builder 4, I can type something like “override protected function myFun…” and it’ll automatically complete the code, including all inputs and return type. Very useful!

You must be logged in to post a comment.

  1. No trackbacks yet.