Actually, you have four commonly used options whenever a parameter or property is of type ApplicationDomain:
null new ApplicationDomain() ApplicationDomain.currentDomain new ApplicationDomain(ApplicationDomain.currentDomain) New ApplicaitonDomain() will never work for modules. It is used in MarshallPlan configurations. ApplicationDomain.currentDomain is used to load classes that you do not wish to unload. Once you mix classes from a loaded SWF into the current ApplicationDomain, they cannot be unloaded. RSLs use this option, and StyleModules occasionally use this option. Shared Code modules may use this option. It depends on whether the classes in the loaded SWF should remain encapsulated or not. New ApplicationDomain(ApplicationDomain.currentDomain) is usually what happens when you use null. It creates a child ApplicationDomain which encapsulates the classes which allows them to later be unloaded. The problem is that the value of ApplicationDomain.currentDomain changes based on the SWF that owns the code. Because ModuleManager is almost always in the main SWF, the null value, which implies “new ApplicationDomain(ApplicationDomain.currentDomain) always creates a child ApplicationDomain of the main SWF, even though you might have called it from a module. This is resolved in Flex 4.5 with fancier code, but you said you were using Flex 3. So, you are probably loading all modules into the main SWF’s applicationDomain which is probably not really what you want if you care about unloading. You’ve essentially converted that module into an RSL, which is why it works. You probably want to use “new ApplicationDomain(ApplicationDomain.currentDomain)” which is not the same as null when called from a module. Tricky, isn’t it? -Alex On 4/10/12 7:05 AM, "Bill Franklin" <bill.frank...@bayer.com> wrote: Thanks Alex, Is there a time when you wouldn’t want to put ApplicationDomain.currentDomain in the IModuleInfo.load call? Freundliche Grüße / Best regards, Bill Franklin Computer Integrated Mfg. [cid:3416891253_101178086] Bayer CropScience LP 8400 Hawthorne Road, Room 2447 Kansas City, MO 64120 Tel: +1 816 242 2148 Fax: +1 816 242 2047 E-mail: bill.frank...@bayer.com Web: http://www.bayercropscience.com Vorstand: Sandra E. Peterson, Vorsitzende | Lykele van der Broek, Achim Noack, Rüdiger Scheitza, Michael A. Schulz Vorsitzender des Aufsichtsrats: Werner Baumann Sitz der Gesellschaft: Monheim am Rhein | Eintragung: Amtsgericht Düsseldorf, HRB 46985 From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Alex Harui Sent: Tuesday, April 10, 2012 1:44 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Nested Modules: "No destination with id null is registered with any service" Make sure you have loaded the modules correctly. You have to specify the applicationDomain of the nested module otherwise it will become a sibling. On 4/9/12 2:35 PM, "BillF" <bill.frank...@bayer.com> wrote: Flex SDK v3.6 Okay, I have a module that is called from an application. That module calls another module. Trying to run any RemoteObjects from the nested module is failing, resulting in the following error: TypeError: Error #1034: Type Coercion failed: cannot convert Object@d3dcad9 to mx.messaging.messages.IMessage. Viewing the RemoteObject call in CharlesProxy gives the error: "No destination with id null is registered with any service" The exact same RemoteObject call works correctly in the parent module, but not in the child module. Any ideas? -- Alex Harui Flex SDK Team Adobe Systems, Inc. http://blogs.adobe.com/aharui
<<inline: image.gif>>