qq_29816271 2015-09-21 02:43
浏览 1900

flex web项目 安全沙箱冲突问题

本人想通过flex页面调用客户端本地的一个socket实现智能提醒功能(该程序是客户端程序,非web项目),根据网上的资料,本人是在本地先测试的,然而还是报
“encounter security error:Error #2048: 安全沙箱冲突:http://localhost:8080/CommunityHealth/SocketTest.swf 不能从 127.0.0.1:5025 加载数据。”,已经尝试了好几天了一直实现不了,还请前辈们指导:
具体情况如下:
自己的tomcat下的root目录中放置了crossdomain.xml内容如下(本人通过浏览器浏览该xml没有问题):
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">





然后在页面初始化的时候加载策略文件,代码如下
private var sock:XMLSocket = null;
//Initial the GUI
private function initApp():void {
Security.loadPolicyFile("http://localhost:8080/crossdomain.xml");
}
//Click logon
private function connectServer(event:MouseEvent):void {
if (this.sock != null)
return;
this.sock = new XMLSocket();
//Refer to XMLSocket document, follow the sample here
this.configureListeners(this.sock);
this.sock.connect("127.0.0.1", 5025);
this.sendButton.enabled = true;
}





  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥50 winform中使用edge的Kiosk模式
    • ¥15 关于#python#的问题:功能监听网页
    • ¥15 怎么让wx群机器人发送音乐
    • ¥15 fesafe材料库问题
    • ¥35 beats蓝牙耳机怎么查看日志
    • ¥15 Fluent齿轮搅油
    • ¥15 八爪鱼爬数据为什么自己停了
    • ¥15 交替优化波束形成和ris反射角使保密速率最大化
    • ¥15 树莓派与pix飞控通信
    • ¥15 自动转发微信群信息到另外一个微信群