0

I have a basic mini game working with flash and node.js in my localhost, and I'm hoping to move the backend to a remote server. I've created an Amazon EC2 instance, installed node.js, npm and got it running and listening on port 1337. The thing is now I'm getting a sandbox security error in flash now. I'm using FlashDevelop and compiling with the "Use Network services" to true. I'm not sure how to handle the crossdomain.xml issue. Do I need to listen for a request within node.js for this specific file and output the contents?

My actionscript:

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);

In node I'm using the net module for communication with flash via sockets:

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 


});
Bastrix
  • 161
  • 1
  • 10
  • Similar question here, may be worth a look: http://stackoverflow.com/questions/14368576/sending-data-from-flash-to-node-js-server-with-socket-io – net.uk.sweet Feb 26 '13 at 23:59
  • Thanks, it's similar, but I'm using the net module instead of socket.io in node, and I'm not sure how to listen and output the policy file... I can't find an example. – Bastrix Feb 27 '13 at 06:58
  • Possible duplicate of [Why is Flash demanding a crossdomain.xml file when the .swf and http target are both on localhost?](http://stackoverflow.com/questions/6222499/why-is-flash-demanding-a-crossdomain-xml-file-when-the-swf-and-http-target-are) – Paul Sweatte Jan 17 '17 at 16:00

0 Answers0