-1

I'm getting the "Base class is final" error on a project that uses the AIR for iOS player. Problem is I didn't set the base class to be final. Also this only happens when I use AIR as the player.

Main - document class

package {
    import flash.display.*;
    import parentfolder.*;
    import parentfolder.childfolder.*;

    public class Main extends MovieClip {

        public function Main () {
            addChild (new SplashScreen ());
        }
    }
}

Screen - inside parentfolder which is in the same folder as the document class

package parentfolder {
    import flash.display.*;

    public class Screen extends Sprite {
        public function Screen () {

        }
    }
}

SplashScreen - inside parentfolder

package parentfolder.childfolder {
    import flash.display.*;
    import parentfolder.*;

    public class SplashScreen extends Screen {

    }
}

So...there's no "final" anywhere in the code and the problem is isolated in the AIR player.

TreeTree
  • 3,200
  • 3
  • 27
  • 39

2 Answers2

0

Your issue is with Screen.

You are trying to extend from it in this line

public class SplashScreen extends Screen

Screen is declared as public final class Screen.

So you cannot inherit from a class that is final.

Quoting the Adobe Docs,

Specifies that a method cannot be overridden or that a class cannot be extended. An attempt to override a method, or extend a class, marked as final results in an error.

Ranhiru Jude Cooray
  • 19,542
  • 20
  • 83
  • 128
0

There is a class in AIR called Screen, which is declared as final. You've used the .*notation on your imports, therefore flash.display.Screen is assumed as the base class for SplashScreen, instead of your custom parentfolder.Screen.

Since this class exists only in AIR, the problem does not occur in other players.

You should always use fully qualified imports (one for each class) to avoid naming conflicts like this.

weltraumpirat
  • 22,544
  • 5
  • 40
  • 54