Skip to main content
Participant
March 10, 2011
Answered

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

  • March 10, 2011
  • 2 replies
  • 2438 views

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.
Correct answer Nicolas Yuen

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
March 14, 2011

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.

Participant
March 16, 2011

That's what I wanted to see - great !

Thanks,