Several ways to access other domain SWF files, or the local browser runtime environment "Security sandbox" conflict resolution

Source: Internet
Author: User

Statement:

Several methods are derived from the network, I only responsible for the summary of a sudden, because from the multi-reprint, also can not find the original source, need to be free to collect, make the most use, good ^_^


For a similar error message:
Securityerror:error #2148: SWF file file:///F:/work2010/tiger/rmpublisher.air/bin-debug/index.swf cannot access local resources file:///F:/ Work2010/tiger/rmpublisher.air/bin-debug/plugins/plugins.xml. Only file system-only SWF files and trusted local SWF files can access local resources.
At Flash.net::urlstream/load ()
At Flash.net::urlloader/load ()
At Com.edlt.utils::settings/loadsettings ()
Workaround:

The first type:

Right-click on the Flex Project-->properties-->actionscriptcompiler-->additional compiler arguments
Add "-use-network=false", this way SWF can not access network resources, such as socket communication. So it's best not to use it.

The second type:

Find the Windows installation directory under the System32/macromed/flash/flashplayertrust, in this directory to build a random text file, in the file input needs to access the local resources Flash detailed path, save. Execute the SWF, no more errors. Ok

such as: In the C:/windows/system32/macromed/flash/flashplayertrust directory to add a file, such as: 1.txt (file name can be any), the file content is: "d:/demo/test/" is the path of the project, Of course, it can also be set to "d:/". You need to close the browser this setting will take effect because if the browser is running, Flash player has read the contents of the Flashplayertrust and the new settings will not take effect. Refer to http://kb2.adobe.com/cps/518/cpsid_51814.html.

The third type:
If you have a SWF that can be accessed by another domain, use Flash.system.Security.allowDomain (), Flash.system.Security.allowInsecureDomain (). The parameter is set to "*" to allow all domains to access it.

The fourth type:

On the Flash plugin, right-click Global Settings, Advanced, developer tools, trusted location settings, add, and then add your files or folders.

Description: During a local test, Flash Player can display a security warning that prevents the application from running correctly. You can resolve this issue by using the trusted Location Settings panel to designate your own SWF or FLV content as trusted content. You can specify the path of an individual file as a trusted path, or specify a folder as a trusted folder. All files and any subfolders in the trusted folder are also trusted. Use this tab to specify the location on your computer that contains SWF or FLV content that you trust. Trusted content does not follow security rules that prevent content from accessing the Internet and the local computer's file system.

Note the above path, choose to add the time to confirm whether the recognition is correct, and finally "file://omitted ..." This path is right (manual input), the above path is identified problem, because this I tangled n days, I hope you don't repeat it ^) ^

The fifth type:
Use policy file: Content can be IP, domain name, *.
<?xml version= "1.0"?>
<!--Http://www.mydomain.com/crossdomain.xml--
<cross-domain-policy>
<allow-access-from domain= "www.otherdomain.com"/>
<allow-access-from domain= "*.adobe.com"/>
<allow-access-from domain= "123.45.67.89"/>
<allow-access-from domain= "*"/>
</cross-domain-policy>
Then use Flash.system.Security.loadPolicyFile () to read this policy file. This approach is the most flexible and safest way.

Several ways to access other domain SWF files, or the local browser runtime environment "Security sandbox" conflict resolution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.