问题
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()
methodLooks 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