为什么我的闪光灯不从服务器获取JSON数据 [英] Why my flash is not getting the JSON data from a server
本文介绍了为什么我的闪光灯不从服务器获取JSON数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建一个闪存项目,我从服务器加载数据。当我运行从Flash软件使用<大骨节病>控制骨节病> + <大骨节病>输入骨节病>或创建 exe文件,然后是工作,但是当我运行的SWF正常或使用浏览器则是行不通的。
I am creating a flash project where I load data from server. When I run that from flash software using Ctrl+Enter or create exe then that works but when I run swf normally or using a browser then it is not working.
我尝试添加该code,但不工作
I tried to add this code but not working
Security.loadPolicyFile("policy.xml");
or
Security.allowDomain("192.168.10.8");
Security.allowDomain("www.example.com");
我的policy.xml是
My policy.xml is
<cross-domain-policy>
<allow-access-from domain="*" />
<allow-access-from domain="www.example.com" />
<allow-access-from domain="192.168.10.8" />
</cross-domain-policy>
请咨询我。
推荐答案
我建议尝试LoaderContext类。下面是例如code:
I suggest to try LoaderContext class. Here is example code:
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var loader:URLLoader = new URLLoader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onDataLoaded);
loader.load(new URLRequest("http://www.example.com/json_file_path.json"), new LoaderContext(true));
这篇关于为什么我的闪光灯不从服务器获取JSON数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文