Fixing security sandbox violation in Flash AS3
http://www.wildbunny.co.uk/blog/2012/11/05/fixing-security-sandbox-violation-in-flash-as3/ ?security sandbox关于安全的一篇帖子
This time I wanted to talk about the dreaded Security sandbox violation error which Flash will sometimes throw at you when you’re working with external websites,or sockets,or file access across local/web. What is a security sandbox violation?Flash applications run inside a security sandbox which prevents them from accessing data they shouldn’t be. For example if your application is web-based,it will be forbidden from accessing files on a user’s local hard drive. If the application is not web-based then it will be forbidden from accessing the web.?You can read more about these two types here. When an application attempts to access data outside of its sandbox,you will see an error which looks similar to this:
This can happen in a number of different cases: The application sandbox is set incorrectlyThis can happen when the sandbox is configured to be used one way,but is being used in another way by mistake. You can change this setting: In Flash IDE?by going to?File->Publish Settings->Flash->Local playback security?and choosing either ‘Access local files only’ or ‘Access network only’. In FlashDevelop?by right clicking on your project->Properties->Compiler Options->Use network services In Amethyst?by right clicking on the project in the solution explorer->Properties->Compiler->Use network You are accessing a web-service across domainsIf your application is web-based and is accessing a web-service of some kind on a different domain to the one the .swf file is hosted on you can get a sandbox violation if the domain you are accessing does not have a valid cross domain policy in place. The root?of the domain you are accessing must have a valid?crossdomain.xml?file. Here is an example crossdomain.xml:
Read more on the specification of this file here You are accessing a web-service from your local machine during developmentBecause of the two different sandbox modes,when developing an application which accesses a web-service but debugging or running locally you will cause this exception to fire. In order to get around this you will need to tell Flash that you give permission for this to happen. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |