2 Replies Latest reply on Nov 15, 2007 11:06 AM by Jeffrey_Owen

    Cross Scripting With SWFLoader/ModuleLoader

      I would like to be able to load a Flex Application/Module dynamically into a parent Flex application using either the SWFLoader or ModuleLoader classes and access the properties and methods of the loaded application. I have tried using both and have loaded applications successfully, but I am unable to figure out how to access the data in the loaded application/module. The content of the loaders is always a SystemManager.

      I would like to see an example of an Application being loaded dynamically and how the shell can communicate with the module and the module can communicate with the shell.

      Here is an example of what I'm trying to do:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="init()">
      import mx.events.ModuleEvent;
      private function onLoaded(event:ModuleEvent):void
      var loader:LoaderInfo = ModuleLoader(event.target).loaderInfo;
      loader.content.name = "John Smith";
      <!-- Where Test.swf contains a Module in this case -->
      <mx:ModuleLoader url="Test.swf" ready="onLoaded(event)" />

      Can anyone elaborate on why one would use a ModuleLoader/SWFLoader/etc. over Loader?