Hello I have a simple login system made in flash as2.
I need to be able to access a php file across the internet through sendAndLoad(“my domain”)
I can do this if the files are in the same directory I know.
But I need them across the internet.
Could someone write up an example cross domain policy file and tell me how to load it in flash ?
This is my current crossdomain policy file
<?xml version="1.0"?>
this is how Im loading it in flash currently
System.security.loadPolicyFile(“http://gamez-over.net/crossdomain.xml”);
Here’s something I wrote that includes policy file usage (or should; you may need to scroll through it a bit) along with an example:
http://www.senocular.com/flash/tutorials/contentdomains/
Its in AS3 but the same applies to AS2. Note that you don’t have to use loadPolicyFile
for policy files in their standard location. Its only needed if you’re loading a policy file from a location other than the default. Flash player automatically loads the policy file when its needed.
Sorry let me further explain.
This is for a swf that will be distributed.
I want the swf to be able to access php files on a web server for a log in system.
I didn’t see exactly how to do that in the tutorial. I did read it over. but nothing I could take for what I needed from what I saw.Could you possibly write an example for what I need?
What do you mean by distributed? If its being run locally, you want
http://www.senocular.com/flash/tutorials/contentdomains/#LocalSecurityDomains
If you’re talking about a web hosted SWF that has to access another domain, then see
http://www.senocular.com/flash/tutorials/contentdomains/#Non-executableTrust
I am placing the swf in a program that is going to be distributed.
Users will need to be able to call to a php file on my web server from the application on there computer.
I tried the solutions you suggested but cant get them to work even when running in the flash player.
If running from the flash player in the authoring tool, you should have a pretty open security surface. A local development configuration means you don’t have to worry about all these things. If you’re still having problems there, it goes beyond these requirements. For that, double check your code, making sure its doing what it needs to do and make sure you have the URL right and all that jazz.
Since it sounds like you’re running flash locally, you’ll need to make sure you publish your SWF with the access network flag (this is what “Local Security Domains” talks about). This is set in the publish settings of the authoring tool under the name “Local Playback Security”. Once thats set, you need to also make sure your crossdomain file is saved on the server you’re trying to load the content from. For example if I’m loading kirupa.com/data.php
the crossdomain file should be on kirupa.com. Then, when you run your SWF, it should be able to load content from a network (thanks to the access network flag) and not be blocked from loading content from the specific site targeted (thanks to the crossdomain file).
this is a screen shot of my current publish settings.
This is my current xml
<?xml version="1.0"?> <cross-domain-policy> <site-control permitted-cross-domain-policies="by-content-type"/> <allow-access-from domain="gamez-over.net/*"/> <allow-access-from domain="*gamez-over.net"/> </cross-domain-policy>
what should I change? and how should I change it?
It still does won’t connect to the files.
your crossdomain.xml file is on gamez-over.net, it doesn’t need to grant access to itself. Allow domain for *
. Local files have no domain of their own so you have to go all out to allow it.
sorry to bother you again. I never really got this working.
I cant distribute the files because of the crossdomain issue. I think that is the problem anyway.
It only works on the host not the anywhere else. even the host machine cant have it anywhere but the htdocs folder.
should I upload my files. so you can see whats going on?