开发者

how to embed flash that is trying to access xml in it's original folder

开发者 https://www.devze.com 2022-12-24 07:30 出处:网络
I\'ve got various flash files stored on my server. For this exmaple - here is the directory structure:

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="h开发者_开发问答ttp://www.example.com/Files/Example/example.swf">
...

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)


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/">


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


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]
0

精彩评论

暂无评论...
验证码 换一张
取 消