views:

83

answers:

3

I've got various flash files stored on my server.

For this exmaple - here is the directory structure:

Files > Example >

-> example.swf
-> example.xml

So then on a separate webpage stored in the root of my server.. i'm embeding the flash.

...
<param name="movie" value="http://www.example.com/Files/Example/example.swf"&gt;
...


Now the issue comes. Because the .swf is trying to access example.xml ... which is NOT stored in the root directory. How can I fix this problem?
(I'd rather not use an iframe)

+1  A: 

What you need is to put a cross domain policy xml file in the root of your server.

   <? xml version="1.0">

   <cross-domain-policy>
       <allow-access-from domain="www.yoursite.com" /></allow>
   </cross>

This way the SWF will have access to the XML's.

More Info:
http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html

JeremySpouken
It's not cross domain. It's just in a different folder.
mkprogramming
Is the xml in the web server, is it accessible via browser?
JeremySpouken
+2  A: 

You can use the BASE attribute of the object/embed tag for the Flash player.

By default, relative paths in Flash are resolved relative to the page that contains the Flash, not relative to the swf file. The BASE attribute lets you specify another URL, other directory path, that is used to resolve relative URL's.

So for your example above, you could add this:

<param name="base" value="http://www.example.com/Files/Example/"&gt;
Lars
A: 

The correct way would be to change the flash to accept the xml path as a flashvar. If you can't do that, rewrite it:

# .htaccess
RewriteEngion On
RewriteRule path/where/flash/expects/the/file.xml the/actual/path.xml [L]
Rob