Flex 下面處理Cross Domain 問題
Step 1 .
開啟記事本/Nopad++
在內容貼上
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtads/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
之後存檔為 crossdomain.xml
Step 2.
把他傳上去你Service的位置下面
假設你愈讀取 http://www.service.com/data.xml
那你就得把 crossdomain.xml 放在 http://www.service.com/crossdomain.xml
Step3.
在flex 的 Applocation 加入 initialize="initDomain()"
則此function的內容是
private function initDomain(): void
{
Security.allowDomain("*");
Security.loadPolicyFile("http://service.mallgic.net/FBAD/DataSorce/crossdomain.xml");
}
大致上就是這樣..XD...馬的花了我一點時間
讚一下:
標籤:
cross domain,
Flex
|
This entry was posted on 下午2:51
and is filed under
cross domain
,
Flex
.
You can follow any responses to this entry through
the RSS 2.0 feed.
You can leave a response,
or trackback from your own site.
0 意見:
張貼留言