Search code examples
actionscript-3flashdevelop

as3 - Error: Classes must not be nested


I tried to generate a preloader class linked in the main class in as3 but now my main class keeps getting an error on compile.

I don't know why this is happening because the code was working earlier. If it helps my ide is flashdevelop 5.2.0.3 (I tried updating from 5.1.1.1)

Before when I try to compile I initially get "Error: null", Build halted with errors (fcsh). and then on attempting to compile again I get "Error: Classes must not be nested."

I tried cleaning the project as has been suggested on similar questions but have had no success with this problem.

Any help would be greatly appreciated.

(skipping import statements and package)

    [Frame(factoryClass="Preloader")]

    public class Main extends Sprite {

      private var adventure_model:AdventureModel;

      private var title_view:TitleView;
      private var title_controller:TitleController;

      protected var panelCollection:PanelCollection = null;


      public function Main():void 
      {
        if (stage) init();
        else addEventListener(Event.ADDED_TO_STAGE, init);
      }

      private function init(e:Event = null):void 
      {
        removeEventListener(Event.ADDED_TO_STAGE, init);
        // entry point

        panelCollection = new PanelCollection();
        adventure_model = new AdventureModel();
        title_controller = new TitleController(adventure_model, panelCollection);
        title_view = new TitleView(adventure_model, title_controller, "title_view", 0, 0, panelCollection);
        addChild(title_view);
    }

}

Solution

  • This problem was found as code errors in an unrelated class and also highlighted errors with Vectors I had. Many thanks.