1 Reply Latest reply on Sep 3, 2009 6:30 AM by MastroBardo

    loaded Flex application problem

    MastroBardo

      Hi all , first Post!

      first of all , srry for my bad english , im not an english speaker ...

      I'm developing an application that should load external flex application. These loaded applications are developed , and the client wont remake them.
      Once these application are loaded , i have to set some property readed from a config.xml file on them. i have a single loaded application at time , and i use a swf loader , but i have tried also with a simple loader.

      ActionScript Code:
      // launched on load complete
      private function addContent(e:Event):void{          
            loaderManager = contentLoader.content as SystemManager;     
            loaderManager.addEventListener( FlexEvent.APPLICATION_COMPLETE, addComplete );    
          }

      // here im sure the application is loaded
          private function addComplete(e:FlexEvent):void{
            var loadedApp:Application = Application( loaderManager.application ) ;       
            for each (var prop:Object in core/*this is an oject i use to store variable loaded from xml*/ ){
               try{
               loadedApp[prop.name().toString()] = prop ;
               }catch(e:Error){
                 trace ("error on creation of "+ prop.name().toString() + " on " +loadedApp);
               }
             }


      With an empty flex application , with only some trace on init and on setter of property , i have no problem.
      But if i use the real application to load , i have a long series of problems :

      1. I have to use a different application domain , to avoid class / variable confilct : this way i can't get the reference to the loaded application system manager(loaderManager = null) , so i can't set properties on it , and i can't listen for FlexEvent.APPLICATION_COMPLETE.

      2. It seems that the loading application can't load his own assets : it throws a series of runtime error , on loaded Systemmanger.create() ( ithink these error come from sound assets , but i dont know really)

      3. Dimension of the loaded content : im actually using a swfLoader , also if i ignore the above descripted errors , the loaded swf take always his own dimension , and not the SWFloader 's.

      i tryed with normal loader , with LoadForCompatibility , trust content , loaderContext on swf loader ,and also with a wrapper module that load the swf, but nothing.
      Somebody can help me before i go to a neuropsychiatric hospital? Really there isn't a way to build a modular application without rely on modules?

      tnx in advance