views:

3403

answers:

4

Hi,

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  A: 

From the docs:

loadPolicyFile() method

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

Tomalak
can the url be a local file path?
asawilliams
This would violate sandbox security. So, without looking it up, my money is on "no".
Tomalak
A: 

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.

Andy
A: 

do i place this loadPolicyfile() in my applications init method? and also does this give me any less access than placing the file at the context root?

combi001
Please use the comments feature for comments. :)
Tomalak
A: 

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