8 Replies Latest reply on Jan 19, 2011 2:16 PM by mattrichard

    Instantiation attempted on a non-constructor.

    mattrichard

      I'm new to flex and trying to convert a project from a purely AS3 project to a Flex 4 project.  I'm trying to use a custom application class, and getting this strange error:

       

       

      TypeError: Error #1007: Instantiation attempted on a non-constructor.

      at mx.preloaders::Preloader/initialize()[E:\dev\4.x\frameworks\projects\framework\src\mx\pre loaders\Preloader.as:253]

      at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::initialize()[E:\dev\4.x\frameworks\projects\fr amework\src\mx\managers\SystemManager.as:1925]

      at mx.managers::SystemManager/initHandler()[E:\dev\4.x\frameworks\projects\framework\src\mx\ managers\SystemManager.as:2419]

       

      Here's a minimal example of the code causing this error:

       

      (FancyAppClass.mxml)

      <?xml version="1.0" encoding="utf-8"?>
      <main:FancyApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                        xmlns:s="library://ns.adobe.com/flex/spark" 
                        xmlns:mx="library://ns.adobe.com/flex/mx"
                        xmlns:main="main.*">
      </main:FancyApplication>
      

       

      And in FancyApplication.as:

      package main {
           import spark.components.Application;
      
           public class FancyApplication extends Application {
                public function FancyApplication() {
                     super();
                }
           }
      }
      

       

       

      What am I doing wrong?  The weirdest part is that sometimes the error goes away only to come back later after some minor code change that seems completely unrelated.