flex load policy file crossdomain.xml

走远了吗. 提交于 2019-12-02 02:02:50

问题


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?


回答1:


From the docs:

loadPolicyFile() method

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




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/527911/flex-load-policy-file-crossdomain-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!