简体   繁体   中英

AS3 | SWF load issue

When I export my project as a swf file it won't load the XML file from the url address & images from the url. I'm trying to export it as an exe file and it works. With Ctrl+Enter in Adobe Flash it works too. How to fix it?

  1. In debug mode, cross domain security checks are disabled (this is why you are allowed to do that with ctrl+enter)
  2. As exe you are already in a differrent context which allows you to load files from any url since your exe is running on your dekstop.

To fix the issue, you need to be in one of the following cases:

a) you load data from url's in the same domain as your swf,

ex: your swf is at mysite.com/myflash.swf and loads an xml from mysite.com/somefile.xml

b) you load data from a differrent domains, in this case you need a cross-domain.xml file in the root url of the domains where you load the xml's from

ex: you now load an xml from someothersite.com/somefile.xml

More details about cross-domain.xml and security policies you cand find by google..

Can someone post a well formed crossdomain.xml sample?

http://www.adobe.com/devnet/adobe-media-server/articles/cross-domain-xml-for-streaming.html

If your XML file is still local (ie, not uploaded to a live server) most browsers, by default, will prevent .swf files from loading local files.
You CAN set a browser to open while ALLOWING access to local files, eg:
Put a short cut to Chrome on your desktop. Right click it and click Properties. In the 'Target' field, add...

--allow-file-access-from-files

...after the .exe
This should allow you to load the XML file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM