Hi,everyone,when the main swf load a module swf located in another domain,the 
flex application encount an error:mx.core::LayoutContainer could not be found

(1)I have add a crossdomain. xml on the server side<?xml version="1.0" 
?><!DOCTYPE cross-domain- policy SYSTEM "http://www. macromedia. com/xml/dtds/ 
cross-domain- policy.dtd"><cross-domain- policy>  <allow-access- from 
domain="*" />       <allow-http-request- headers-from domain="*" 
headers="*"/></cross-domain- policy>(2)In the main SWF:                
<mx:Application xmlns:mx="http: //www.adobe. com/2006/ mxml" layout="absolute" 
creationComplete= "appInit( )" preinitialize= "initHandler( );">      
<mx:Script>         <![CDATA[              private function initHandler( ):void 
             {                  Security.allowDomai n("localhost" );            
      Security.loadPolicy File( "http://localhost: 8888/abflash/ crossdomain. 
xml" );                  var loader:URLLoader = new URLLoader();                
  loader.addEventList ener( Event.COMPLETE, loadHandler );          
        loader.load( new URLRequest(" http://localhost :8888/abflash/ 
crossdomain. xml"));              }              private function loadHandler( 
evt:Event ):void              {                                   // 
moduleLoader. url = "http://moduleserve r/modules/ MyModule. swf";              
}          ]]>     </mx:Script> (3)In the Module SWF:  <mx:Module 
xmlns:mx="http: //www.adobe. com/2006/ mxml" layout="absolute" width="400" 
height="300"
 initialize=" initHandler( );">  <mx:Script>         <![CDATA[              
private function initHandler( ):void              {                  
Security.allowDomai n("localhost" );              }          ]]>     
</mx:Script>       <mx:Button x="32" y="75" label="Button" />      <mx:Label 
x="41" y="37" text="fsdsadfsafsad f"/></mx:Module>


      
 

      

    
    
        
         
        
        




        




        
        


        
        
        




      

Reply via email to