2010-08-11 123 views
1

我在使我的跨域策略正常工作時遇到了一些困難。 我有一個swf在http://www.server.com/加載XML和其他文件。我希望能夠將swf嵌入不在同一個域中的其他HTML頁面(YouTube風格)。它正常工作時通過它訪問的本地服務器http://www.server.com/my.swfhttp://www.server.com/swf.html但是當我試圖把它嵌入不會加載XML,並/或給我一個Security sandbox violationcrossdomain.xml的問題

發佈的SWF設置爲Security.REMOTE

的crossdomain.xml允許所有:

<?xml version="1.0"?> 
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> 
<cross-domain-policy> 
<allow-access-from domain="*" to-ports="*"/> 
</cross-domain-policy> 

希望你能幫助

更新1

嵌入代碼的一個例子是:

<!-- Embedding --> 
<object width='400' height='300'> 
<param name='movie' value='http://www.server.com/my.swf'></param> 
<param name='allowFullScreen' value='true'></param> 
<param name='allowscriptaccess' value='always'></param> 
<param name='FlashVars' value="stream=1281002679" ></param> 
<embed src='http://www.server.com/my.swf' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='400' height='300'></embed> 
</object> 

...它可以添加到任何網頁上的任何域

更新2

policyfiles.txt(192.168.100.55是我的本地測試包含嵌入例如服務器):

OK: Root-level SWF loaded: http://www.server.com/my.swf 
OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at http://192.168.100.55/data/configuration.xml?refresh=0.2777715688571334 by requestor from http://www.server.com/my.swf 
Warning: Failed to load policy file from http://192.168.100.55/crossdomain.xml 
Error: Request for resource at http://192.168.100.55/data/configuration.xml?refresh=0.2777715688571334 by requestor from http://www.server.com/my.swf is denied due to lack of policy file permissions. 

的flashlog.txt提取 Warning: Failed to load policy file from http://192.168.100.55/crossdomain.xml

我是否需要通過Security.loadPolicyFile('http://www.server.com/crossdmoain.xml')加載crossdomain.xml?

+0

只是可以肯定的,哪兒來你把你的crossdomain.xml?在哪裏找到XML和其他加載的文件? – David 2010-08-11 15:21:52

+1

我的直覺是,這不是一個跨域問題。嵌入式文件仍然從您用於檢索XML的相同域中嵌入。你能顯示你的嵌入代碼嗎? – JeffryHouser 2010-08-11 15:39:38

+0

crossdamain.xml位於服務器的根目錄 XML位於子目錄 – Trist 2010-08-11 16:34:20

回答