This content has been marked as final. Show 7 replies
I did not manage to reproduce this behavior. If possible post the code that triggers the error or file a bug here and anay relevant details of your installation - e.g. OS, language settings, flash player version.
Well, the code's fairly spread out right now - but basically i created a new Flex Library Project and in one of the classes in there i just created a new Label -
message = new Label();
the debug from the player is telling me it gets as far as the method in which the label is created, then the label is created and UIComponent gets instantiated and then it fails when it gets to creating the resource manager.
i'm on a PC running XP pro...
here's the full error
TypeError: Error #1007: Instantiation attempted on a non-constructor.
The getInstance() method of ResourceManager relies on the ResourceManager having been already registered with the Singleton class, which happens during application startup. This runtime error would occur if you tried to create a Label so early in the application startup sequence that the ResourceManager hadn't been registered yet with Singleton. I see on your callstack that the calling method is completeHandler() in your LoaderQueue class. Can you explain when this executes?
thanks for your reply, Gordon.
The flow is like this:
I have a library project called Application that loads a config XML file that basically lists all the files for various modules that the application needs to function.
So the app is fired by an actionscript class that calls Application.getInstance().initialise() - this instantiates the Applciation class which in turn instantiates the class that loads the config file and parses it... it runs through the modules defined in the xml and adds each file request to a custom LoaderQueue which creates either a Loader or URLloader, depending on file type which starts to load all of the required files.
When all of the files are loaded it looks to see if a user has a valid chatname defined - if not it loads the Registration module so a user can register.
So the call to create a label is happening after the Application class has instantiated, the ApplicationInitialiser has instantiated and loaded an xml file, parsed it, created a LoaderQueue and added a group of file requests to it, all these files have loaded (currently about 4 or 5, but will eventually be a couple of dozen) and then started up the Registration module - who's 'view' is creating the label... so it's early in the application itself but quite a lot has happened before i start trying to create UIComponents. Incidentally, the skin file for the Registration module is loaded and attached to the display list before the label is created, that happens ok, but then the label won't instantiate.
At what point does the ResourceManager register? This is a purely actionscript project so it occured to me after i've posted that cause i'm not using any mxml components that this could be a big part of the problem.. is that the case? If you want a copy of the code i'm using to recreate this issue then just ask and give me an email address to send it to...
Again, thanks for the reply...
> At what point does the ResourceManager register?
The SystemManager's initialize() method registers the ResourceManager with the Singleton class.
> This is a purely actionscript project so it occured to me after i've posted that cause i'm not using any mxml components that this could be a big part of the problem.. is that the case?
Quite possibly. It sounds like the SystemManager isn't even part of your app. FlexBuilder's "ActionScript Project" is for people who don't want to use any Flex framework components and instead write to the low-level player APIs like Sprite. Since you're using Flex components, you should be starting off with <mx:Application>. Everything else can be an ActionScript component rather than an MXML one, but your top-level file should be in MXML. I'm surprised you're not having all sorts of other problems (for example, with missing style selectors) if you're not doing this.
thanks Gordon, how incredibly embarrasing! :)
i've been working in actionscript for so long now, new to Flex, showing my ignorance... thanks for the help.