A while back I asked how to open a 开发者_如何转开发file in actionscript to supply information for my flash banner.
It works nicely when I just open the flash file on my computer, but when I upload it to my website it does not show the data from the remote text file...
I know that the file reading bit of the program is correct, as it reads local files on the same web server just fine. So I assume it has something to do with either PHP or the FlashPlayer.
Thanks for any help you can give me!
===
How stupid of me to forget to mention that the file being loaded is from a remote server. Thus the path to it is an actual URL. As I said this works fine on the computer regardless of whether the file is local or a remote file.
But on the PHP webserver it only wants to read the local files, it doesn't Read the Remote ones...
===Update
I've tried the crossdomain.xml solution, but it seems not to be working.
The banner is located on the actual webserver (http://forum.mydomainhere.com/) while the text file is located at: http://files.mydomainhere.com/ - this is a DNS reference to my file server.
The xml file i created looks like:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="www.forum.mydomainhere.com/" />
</cross-domain-policy>
As it said I put it on the http://files.mydomainhere.com/ server.
==
EDIT
I changed the www. simply to a * which made it work. That's when I removed the www. bit and it still works like a charm. my quess is my forum doesn't work at www. but just a http://
Thanks for all the help people :)
You're probably having a path issue, meaning Flash can't find the specified file. Flash loads external files starting from its containing page location, eg: the PHP page that contains it, not where the SWF is located.
Further, path may be handled differently on the web server than on the local file system. If you are using relative paths, try adding "./" onto the path, or removing "./" if it is already there.
If you are using absolute paths, make sure the path is in the same domain as the SWF. If the browser is at http://www.mysite.com but Flash is loading the file from http://mysite.com (no www) it is actually in a different security domain, and outside of your sandbox. Make sure they are the same.
If you post some more details, we'll be better able to identify your problem.
I hope that helps,
Edit
Based on comment below, you need a cross domain file on the other server. Lots of info on the web about those, start here for a good guide: http://kb2.adobe.com/cps/142/tn_14213.html
SWF's have different security rules based on where you are running them, when you are debugging through one of the IDE's the security settings are very relaxed.
精彩评论