Can you post link-reports for the main app and the module? The implication is that the factory.create() didn’t work because the module’s class definition is not in the module swf.
On 11/3/11 12:52 PM, "Philip Smith" <loudj...@hotmail.com> wrote: The module loads fine in a simple testbed, but in this particular larger application context, fails (and it's time consuming/costly debugging, when by all extents and purposes, it should work). In the end, I can achieve a similar result with SWFLoader, and cast the result as an interface type... ________________________________ To: flexcoders@yahoogroups.com From: loudj...@hotmail.com Date: Thu, 3 Nov 2011 19:36:57 +0000 Subject: RE: [flexcoders] Re: ModuleLoader.child is null >> Perhaps you're getting an error on load; probably due to the path. Try >> adding an event listener for ModuleEvent.ERROR. The ModuleEvent.READY listener is executing, the path is correct. >> var test:ITest ITest(this._moduleLoader.child); This was a typo. this._moduleLoader.child is still null here though. I get the same problem using mx and spark ModuleLoader. So unless someone can spot the problem, I'm going to use SWFLoader... ________________________________ To: flexcoders@yahoogroups.com From: timh...@aol.com Date: Thu, 3 Nov 2011 18:35:10 +0000 Subject: [flexcoders] Re: ModuleLoader.child is null Perhaps you're getting an error on load; probably due to the path. Try adding an event listener for ModuleEvent.ERROR. Also, this line is missing an equal sign: var test:ITest ITest(this._moduleLoader.child); Should be: var test:ITest = ITest(this._moduleLoader.child); -TH --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "method_air" <loudjazz@...> wrote: > > Can anyone explain why ModuleLoader.child is null in the module event 'ready' > event listener: > > this._moduleLoader = new ModuleLoader(); > this._moduleLoader.url = "ImageComparisonModule.swf"; // > this._moduleLoader.addEventListener(ModuleEvent.READY, onReady); > > private function onReady(e:ModuleEvent):void > { > var test:ITest ITest(this._moduleLoader.child); // null > } > > Module code: > > <?xml version="1.0" encoding="utf-8"?> > <s:Module xmlns:fx="http://ns.adobe.com/mxml/2009" > xmlns:s="library://ns.adobe.com/flex/spark" > xmlns:mx="library://ns.adobe.com/flex/mx" > implements="com.storefront.interfaces.controller.ITest" > > > <fx:Declarations> > <!-- Place non-visual elements (e.g., services, value objects) here --> > </fx:Declarations> > > <s:VGroup width="100%" /> > </s:Module> > > Cheers, > > Philip > -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui