Skip to main content
Participant
Mar 10, 2011 9:52 AM UTC
Answered

ModuleViewLoader - does it load modules into child application domains by default ?

Is the Cairngorm 3, "ModuleViewLoader" loading modules into child application domains by default, or we have to do it our self like this:

public function init():void{

     var childDomain:ApplicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);

  modelLoader.applicationDomain = childDomain;
}

<module:ModuleViewLoader id="moduleLoader"

                  moduleId="{ moduleId }"

                  moduleManager="{ moduleManager }"

                  skinClass="com.adobe.cairngorm.module.ModuleViewLoaderSkin"

                  visible="{this.visible}"

                  width="100%" height="100%">

     <module:loadPolicy>

          <module:BasicLoadPolicy/>

     </module:loadPolicy>

</module:ModuleViewLoader>

I think it's important to know regarding unloading the modules.

Thanks,

This topic is closed to new replies. Start a new post to keep the conversation going.
Nicolas YuenCorrect answer
Adobe Employee
Mar 14, 2011 2:08 AM UTC

Hi Adrian,

We are following the behaviour of the Flex ModuleManager:

  • We use the applicationDomain provided by the user when available
  • Otherwise we create a sub applicationDomain from the current domain.

Here is an extract of the ParsleyModuleInfoProxy

private function createDefaultApplicationDomain(applicationDomain:ApplicationDomain):ApplicationDomain
        {
            // If an applicationDomain has not been specified and we have a module factory,
            // then create a child application domain from the application domain
            // this module factory is in.
            // This is a change in behavior so only do it for Flex 4 and newer
            // applications.
            var tempApplicationDomain:ApplicationDomain = applicationDomain;
           
            if (tempApplicationDomain == null && moduleFactory)
            {
                var currentDomain:ApplicationDomain = moduleFactory.info()["currentDomain"];
                tempApplicationDomain = new ApplicationDomain(currentDomain);
            }
           
            return tempApplicationDomain;
        }   

We will update the documentation to highlight the fact that a sub ApplicationDomain is created by default.

Thanks.

2 replies

Nicolas YuenCorrect answer
Adobe Employee
Mar 14, 2011 2:08 AM UTC

Hi Adrian,

We are following the behaviour of the Flex ModuleManager:

  • We use the applicationDomain provided by the user when available
  • Otherwise we create a sub applicationDomain from the current domain.

Here is an extract of the ParsleyModuleInfoProxy

private function createDefaultApplicationDomain(applicationDomain:ApplicationDomain):ApplicationDomain
        {
            // If an applicationDomain has not been specified and we have a module factory,
            // then create a child application domain from the application domain
            // this module factory is in.
            // This is a change in behavior so only do it for Flex 4 and newer
            // applications.
            var tempApplicationDomain:ApplicationDomain = applicationDomain;
           
            if (tempApplicationDomain == null && moduleFactory)
            {
                var currentDomain:ApplicationDomain = moduleFactory.info()["currentDomain"];
                tempApplicationDomain = new ApplicationDomain(currentDomain);
            }
           
            return tempApplicationDomain;
        }   

We will update the documentation to highlight the fact that a sub ApplicationDomain is created by default.

Thanks.

Translate
Participant
Mar 16, 2011 2:29 PM UTC

That's what I wanted to see - great !

Thanks,

Translate