I'm using a SWFLoader to load a Flex app -- I'll call it the child app - inside 
my main Flex app. I've used tracing code on the server to prove that the child 
app is being requested and served by the SWFLoader. What's happening, however, 
is that a new instance of the main app is being created and displayed inside 
the SWFLoader. It seems that the Flex initialization code is failing somewhere. 
I have this code in the main app's mxml file:

      private function traceStack():Boolean {
          trace("Main.mxml.(): " + new Error("TRACE").getStackTrace());
          return true;
      }

      private var b:Boolean = traceStack();

And the stacktraces that are logged in both the app's initial load and its 
second loading from the embedding are identical:


Main.mxml.(): Error: TRACE
    at 
com.Company.web.app.main::Main/traceStack()[C:\dev\projects\web\src\com\Company\web\app\main\Main.mxml:65]
    at 
com.Company.web.app.main::Main()[C:\dev\projects\web\src\com\Company\web\app\main\Main.mxml:69]
    at 
_Main_mx_managers_SystemManager/create()[_Main_mx_managers_SystemManager.as:53]
    at 
mx.managers.systemClasses::ChildManager/initializeTopLevelWindow()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\systemClasses\ChildManager.as:311]
    at 
mx.managers::SystemManager/initializeTopLevelWindow()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:3057]
    at 
mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::kickOff()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:2843]
    at 
mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::preloader_completeHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:2723]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at 
mx.preloaders::Preloader/timerHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\preloaders\Preloader.as:542]
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()


I should note that the embedding is a result of user action, and that's why 
it's not an infinitely recursive thing. I tried loading the child app with a 
<mx:SWFLoader> tag in the main mxml file, and the results were basically the 
same, except the infinite recursion occurred.

Does anyone have a clue what might be going on here?

Reply via email to