flex load policy file crossdomain.xml

2019-02-27 09:57发布

I want to place my crossdomain.xml file in a different location than the root because it just creates to much dependency issues.

How can i tell flex to look from my crossdomain.xml file somewhere other than the root?Do i add the loadPolicy code to the init method of my flex app?

Does anyone have any good samples on this?

3条回答
对你真心纯属浪费
2楼-- · 2019-02-27 10:07

From the docs:

loadPolicyFile() method

Looks for a policy file at the location specified by the url parameter.

查看更多
虎瘦雄心在
3楼-- · 2019-02-27 10:08

Security.allowDomain("*"); Security.loadPolicyFile("https://play2beatme.com/crossdomain.xml"); use this code inside your init() method...i hope this will help u

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-02-27 10:22

There is another option. If a cross domain policy file isn't specified, then Flex will send "" to the socket server. The server can then write the contents of the cross domain policy file to the socket. Flex will close the connection, and re-connect if everything checks out OK.

The downside to this approach is that it will take about 1-2 seconds from originally making the connection on the Flex side to getting a full, working connection (the flash.events.Event.CONNECT event is sent once the connection is fully established, though). If that isn't acceptable, placing the cross domain policy file in the root is likely your best option.

查看更多
登录 后发表回答