Modules must have a common application domain otherwise you cannot
access them via classes or interfaces.  See my blog for more info
(blogs.adobe.com/aharui)

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Gregor Kiddie
Sent: Monday, January 14, 2008 5:00 PM
To: [email protected]
Subject: [flexcoders] Application domain and Modules

 

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>
    &nb! sp;   <![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();
      &! nbsp; &n bsp;       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>



________________________________

Think you know your TV, music and film? Try Search Charades!
<https://www.searchcharades.com>  

 

Reply via email to