0

我在本地主机中有一个使用 flash 和 node.js 的基本迷你游戏,我希望将后端移动到远程服务器。我创建了一个 Amazon EC2 实例,安装了 node.js、npm 并让它运行并在端口 1337 上侦听。问题是我现在在 flash 中遇到沙盒安全错误。我正在使用 FlashDevelop 并将“使用网络服务”编译为 true。我不确定如何处理 crossdomain.xml 问题。我是否需要在 node.js 中侦听此特定文件的请求并输出内容?

我的动作脚本:

var host:String = "54.234.175.99";
Security.allowDomain(host);
Security.allowInsecureDomain(host);
Security.loadPolicyFile("xmlsocket://" + host + ":" +  "1337");

xmlSocket = new XMLSocket(host, 1337);
xmlSocket.addEventListener(DataEvent.DATA, onData);
xmlSocket.addEventListener(Event.CONNECT, onConnect);
xmlSocket.addEventListener(IOErrorEvent.IO_ERROR, onIOError);

在节点中,我使用 net 模块通过套接字与闪存通信:

var net = require('net');

var server = net.createServer(function(socket) {

socket.on("connect", function(client){
    console.log('new flash client connected')
});

var data_buffer=''; 
socket.on('data', function(data) {
    console.log('received data'+data);
            // do stuff with data 


});
4

0 回答 0