views:

812

answers:

5

We are creating an app that uses modules which are dynamically loaded into the main swf. The problem we run into, is that we are unable to load the modules located on a test server when we are debugging the main app locally. The error we get is "SWF is not a loadable module".

I looked this up and found out that we need a crossdomain file on the server that grants permission to load the modules from external locations. So we created a simple crossdomain file and put that on the server, but this does not seem to help.

Here's the crossdomain file:

<cross-domain-policy>
  <allow-access-from domain="*"/>
</cross-domain-policy>

We are loading the module via the ModuleLoader class and all default settings, no custom app domain etc. When we deploy the main swf onto the server we are able to load the modules without problems.

Any clues? Is the crossdomain file perhaps missing some settings?

Update: It seems that the external module is loaded successfully (I can verify in my HTTP sniffer) but fails to initialize when loaded in the main app. The error still is "SWF is not a loadable module)

A: 

Looks similar to my cross domain

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy 
  SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"&gt;
<cross-domain-policy>
  <allow-access-from domain="*" />
</cross-domain-policy>

That is on your local server root, correct?

Have you checked your directory permissions?

Tony
The crossdomain is in the ROOT directory of our Tomcat installation and I can verify this by browsing to it. The problem seems to be locally, see my update.
Christophe Herreman
+1  A: 

I think Adobe tries to access the cross domain file on port 843 and if it cannot connect/find the file on that port it tries the port that you're trying to connect to (probably 80 if it's http). Not sure but you might want to check to make sure that your server allows access to the file.

Also worth mentioning is that you should allow full access to the directory where your local swf application resides. Do this with the Adobe settings manager: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

As a side note, I think the settings manager is one of the worst UI atrocoties in the flash eco system. Just the fact that they need to clarify in a text underneith the manager that it is infact NOT a screenshot really takes the cake.

macke
lol, agreed. I've sent that link to so many co-workers only to have them come back and say "ok so how do I get to it?"
nerdabilly
A: 

I agree that it could be an issue between local SWFs and remote SWFs. Try uploading your local file to a server (any server you have access to) or, if you've got a local Apache or IIS running, try accessing that SWF using http://localhost/. If that works, we'll know that the issue is in going between a local file and a remote file. If it doesn't than the issue is either with crossdomain.xml or in your code, which is less likely but we shouldn't rule it out just yet. If you do determine that the issue is with using a local SWF, then add the local folder in the Settings Manager (see macke's post)

nerdabilly
+2  A: 

Here is a proposed soultion from Adobe JIRA: http://bugs.adobe.com/jira/browse/SDK-15393

Thanks. The proposed workaround did the trick.
Christophe Herreman
Ditto for me. Oy vey, what a helluva workaround...
Nik Reiman
A: 

Here's a solution bundled up ready for use based on Adobe's recommendation.

http://aaronhardy.com/flex/loading-a-remote-module-into-a-local-app/