Oh that was a great bit of help there Alex, your a star! I tackled the issue a little differently from you Mark (and possibly a bit too in depth when i think about it)... i'll try and explain my situation.
In my app I have a component (navBar) containing 3 Accordions, each with a repeater that creates one or more custom components (navBarSection) that extend the ModuleLoader class. The problem i believe i was having was just what you suggested Alex, that i attempt to start loading the same module (link.swf) more than once at the same time. I copied my links.swf module to another folder, loaded the first instance (from the original url) into one navBarSection component, and loaded the second instance (from the new url) into the other navBarSection component, and the application did not fall over once! So to get to my solution to the problem... i added a property to my navBarsection custom component (moduleURL:String) that i used instead of directly setting the url property (which would immediately load the module!). I then added a few custom events that dispatch: 1. when the moduleURL property was set 2. when the module has finished loading (the component's ready event) When the first event dispatches, the parent component (navBar) will: 1. add the navBarSection to an ArrayCollection 2. search for another navBarSection component in the collection (other than the one recently added) attempting to load a module from the same url 3. if one is not found, the recently added navBarSection will proceed to load the requested module When the second event dispatches, the parent component will: 1. remove the navBarSection from the collection 2. search for another navBarSection attempting to load a module from the same url as the recently removed module 3. if one is found, the navBarSection will proceed to load the requested module (url = moduleURL) This may be a bit rigorous, but it guarantees that no two navBarSection's will be loading the same module at once. I have been giving the app a serious hammering since implementing this, using the same links.swf module url in more than one occassion, and it has not fallen over yet; so it seems the problem is solved. Thanks again for your feedback guys, i was really in a bad situation without your posts. Good luck, Barry --- In flexcoders@yahoogroups.com, "Mark Doberenz" <[EMAIL PROTECTED]> wrote: > > Oh for cryin out loud!!!! > > All I had to do was create an array of ModuleLoaders and add the > ModuleLoader to it when I created it and it kept all the instances just > fine. > > Thank you so much!!!! I can work on this project again! > > Mark > > On Dec 10, 2007 10:10 PM, Alex Harui [EMAIL PROTECTED] wrote: > > > So, the classic 'mistake' was to do this: > > > > > > > > private function loadModule(url:String):void > > > > { > > > > var modInfo:IModuleInfo = ModuleManager.getModule(url); > > > > modInfo.addEventListener(ModuleEvent.READY, readyHandler) > > > > modInfo.load(); > > > > } > > > > > > > > This worked in 2.0.1 because there was a memory leak. We fixed the leak > > in Flex 3 and suddenly, this scenario could cause the module to kick itself > > out. The allocation for the ready event could force a garbage collection > > and nothing has a hard reference to the ModuleInfo or the Module so it away > > it goes. The addEventListener is not a hard reference to the ModuleInfo, > > the reference goes the other direction. > > > > > > > > The answer here is to make sure you store your modInfo references on the > > instance and not in a local variable. Similarly, if I kept only one > > reference, several calls to loadModule would overwrite the last reference > > and allow it to get kicked out. If you're loading several modules, you'll > > need an array of ModuleInfos tracking each module and administrate their > > clean up. > > > > > > > > ModuleLoader keeps hard references so it should be ok, as there should be > > one ModuleLoader per url. But again if you ask it to load more than one > > module, the previous ones may be eligible for garbage collection. > > > > > > > > If you're using 2.0.1, calls to unload() could cause the same sort of > > situation. > > > > > > > > -Alex > > ------------------------------ > > > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > > Behalf Of *Mark Doberenz > > *Sent:* Monday, December 10, 2007 7:20 PM > > *To:* flexcoders@yahoogroups.com > > *Subject:* Re: [flexcoders] Re: ModuleLoader 'SWF is not a loadable > > module' Error > > > > > > > > I've worked on an app too where I used modules heavily. I had/have issues > > where the module doesn't load. I've noticed that the trace log shows that > > the SWF is decompressed, but it never throws the Complete event. I've found > > that sometimes recompiling the app will work. > > > > I'm not sure if it's an ApplicationDomain issue or not. I tried tweaking > > this a while back and never got anywhere, but once I removed it, the modules > > started loading. I didn't have issues with it anymore until just recently > > when I started the project back up again. It made me not work on the app > > b/c I'm tired of hacking with this issue. > > > > Unfortunately, I haven't found a way to really fix this. :( > > > > Mark > > > > On Dec 10, 2007 5:42 PM, Alex Harui [EMAIL PROTECTED] wrote: > > > > GC = garbage collection. W/o a hard reference, the memory manager could > > remove your module. ModuleLoader should be ok hanging on to it. It might > > be possible that if you start two loads of the same swf that the second one > > doesn't finish. Not sure how to prove that. > > > > > > > > I would try to make the smallest possible test case that can reproduce the > > error. > > > > > > ------------------------------ > > > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > > Behalf Of *Barry Evans > > *Sent:* Monday, December 10, 2007 1:47 PM > > > > > > *To:* flexcoders@yahoogroups.com > > *Subject:* [flexcoders] Re: ModuleLoader 'SWF is not a loadable module' > > Error > > > > > > > > Sorry, i forgot to say i'm using flex 2.0.1. > > > > And as for a hard reference, i am creating a number of ModuleLoader > > components within a repeater, so the url of the loaded module is > > dynamic in nature. > > > > What do you mean by a GC? > > > > The weird thing in this situation is that i have another module which > > displays links and is very close in nature to the one giving me > > problems, however it never produces any errors. > > > > I use the problematic module on more than one occassion i.e. when the > > app loads up, the links module is loaded twice. Its only means of > > consistently is that it fails both times it loads (in a single > > application instance). > > > > I am also passing data to the module (on the moduleReady event) using > > a custom Interface, i wonder if this would have any affect? > > > > I followed the Adode dev guide on how to pass data to the module, so > > im not sure this is where the problem stems from, but i thought i > > would mention this. > > > > The only other issue that comes to mind is the sequence in which the > > modules are loaded, but i havent had a chance to apply the > > ModuleLoader's urls manually, and i dont even think this would be the > > problem, just a thought. > > > > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, "Alex > > Harui" aharui@ wrote: > > > > > > Which version of Flex? Are you keeping a hard reference to the > > module? > > > Otherwise, a GC can kick it out just as it finishes loading. > > > > > > > > > > > > ________________________________ > > > > > > From: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com> > > [mailto:flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>] On > > > Behalf Of Barry Evans > > > Sent: Monday, December 10, 2007 9:50 AM > > > To: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com> > > > Subject: [flexcoders] Re: ModuleLoader 'SWF is not a loadable > > module' > > > Error > > > > > > > > > > > > No, this is not the case im afraid. > > > > > > Sometimes the module loads perfectly and the application is fine, > > but > > > sometimes the application throws the error i mentioned in the first > > > post. > > > > > > I catch the main error being thrown by the module loader ('SWF is > > not > > > a loadable module'), but when this occurs the ModuleManager.as > > class > > > (from the Flex framework) always throws an error at line 669: > > > > > > The code at this line is: > > > moduleEvent.bytesLoaded = loader.contentLoaderInfo.bytesLoaded; > > > > > > I have changed the code in ModuleManager.as to now point to the > > > correct object - the event.currentTarget.loader property - (so that > > a > > > null pointer error is not thrown): > > > moduleEvent.bytesLoaded = > > > event.currentTarget.loader.contentLoaderInfo.bytesLoaded; > > > > > > I am not sure how to compile the application (or perhaps rebuild > > the > > > framework.swc file with the new source code) with the changes > > > > > > Either way, the module is not loading properly in a consistent > > > manner, and i am totally confused as to how this would be happening. > > > > > > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com><mailto: > > flexcoders% <flexcoders%25> > > 40yahoogroups.com> > > > , "Alex Harui" <aharui@> wrote: > > > > > > > > is it possible it isn;t a module > > > > > > > > ________________________________ > > > > > > > > From: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com><mailto: > > flexcoders% <flexcoders%25> > > 40yahoogroups.com> > > > > > > [mailto:flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com><mailto: > > flexcoders% <flexcoders%25> > > 40yahoogroups.com> > > > ] On > > > > Behalf Of Barry Evans > > > > Sent: Monday, December 10, 2007 3:51 AM > > > > To: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com> <mailto: > > flexcoders% <flexcoders%25> > > 40yahoogroups.com> > > > > Subject: [flexcoders] ModuleLoader 'SWF is not a loadable module' > > > Error > > > > > > > > > > > > > > > > I am having a problem with a modularised application i am > > > developing. > > > > > > > > I am using modules to load a user-customised application and i am > > > > getting intermittent errors when loading a certain module (SWF is > > > not > > > > a loadable module). > > > > > > > > Having scoured the internet for details of the error, i can only > > > find > > > > answers where the problem is to do with security issues (loading > > > > modules from different domains/crossdomain.xml etc.). > > > > > > > > I am loading all my modules from a relative path > > > > (/modules/navigation/Linksmodule.swf) so security should not be > > an > > > > issue. > > > > > > > > I would really appreciate some help with this anyone might have > > as > > > i > > > > am reaching a release date for the project and i cannot get by > > > > without solving this problem. > > > > > > > > Thanks in advance. > > > > > > > > Barry > > > > > > > > > > > > > > > > > >