Is there any reason why the below code would not work? Although I see the 
module getting loaded when watching the debugger, and I can see that the 
modules always get different Application domains, nothing ever gets added to 
the Content Pane. It does when I load the module without the new 
ApplicationDomain.

The module consists of a MXML view which is just a label, bound to a singleton 
AS class. What I'm aiming for is the ability to load a module with a singleton 
into the same application repeatedly, and have the modules act completely 
seperately (i.e. there is two instances of the singleton, one for each module).

Rogerg.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
    layout="vertical" 
    width="100%" 
    height="100%">
    
    <mx:Script>
        <![CDATA[
            import mx.modules.ModuleLoader;
            
            private function addModule() : void {
                var loader : ModuleLoader = new ModuleLoader();
                loader.url = "SampleModule.swf";
                contentPanel.addChild(loader);
            }
            
            private function addAppModule() : void {
                var loader : ModuleLoader = new ModuleLoader();
                loader.applicationDomain = new ApplicationDomain();
                loader.url = "SampleModule.swf";
                loader.loadModule();
                contentPanel.addChild(loader);
            }
        ]]>
    </mx:Script>
    
    <mx:HBox>
        <mx:Button id="addButton" label="Add a module - SAME" 
click="addModule()" />
        <mx:Button id="addAppButton" label="Add a module - NEW" 
click="addAppModule()" />
    </mx:HBox>
    
    <mx:VBox id="contentPanel" width="100%" height="100%" />
    
</mx:Application>


_________________________________________________________________
Get Hotmail on your mobile, text MSN to 63463!
http://mobile.uk.msn.com/pc/mail.aspx

Reply via email to