Child SWF files don't load at runtime

Child SWFs or modules, including resource modules, that are loaded at runtime sometimes fail to load when the SWF file location is specified as a URL parameter (such as "resourceModuleURLs").

Typical scenarios

The following are typical scenarios that could cause this issue. For example, do not pass the location of the child SWF  as a query string parameter in an HTML page:

<!-- Don't do this -->
		
	<a href="http://www.example.com/MyApp.swf?stylemodule=http://www.example.com/mymodule.swf">Click here</a>

Or in your wrapper's script:

/* Don't do this */
		
	swfobject.embedSWF(
		
	    "MyApp.swf?resourceModuleURLs=http://www.example.com/mymodule.swf",
		
	    "flashContent", "100%", "100%",      
		
	    swfVersionStr, xiSwfUrlStr, flashvars, params, attributes); 

Or in your MXML:

<!-- Don't do this -->
		
	<mx:SWFLoader source="http://www.example.com/MySubApp.swf?styleModules=http://www.example.com/mystylemodule.swf"/>

Solution

Instead of passing the location of the child SWF file as a URL parameter, pass it as a flashVars variable in the HTML wrapper's script:

/* Do this */
		
	var flashvars = {};       
		
	flashvars.resourceModuleURLs = “http://www.example.com/mymodule.swf”;
		
	swfobject.embedSWF(     
		
	    "MyApp.swf",     
		
	    "flashContent", "100%", "100%",     
		
	    swfVersionStr, xiSwfUrlStr, flashvars, params, attributes);
If you are unable to use that approach, another possible workaround could be to use a different URL parameter name. In the case of resource modules, this would require you to use a custom preloader to load the resource module from that alternate URL parameter.

Additional information

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy