title: AS3 XMLSocket works in WIN EXE but not on SWF
body: <p>I'm trying to make a socket client in FlashAS3 for my socket server written in nodejs. I also have a mobile app client that communicates with it.</p>
  
  <p>In AS3 I wrote some test code that works perfectly when I publish and run Windows EXE file but when publishing to SWF and opening in browsers it does not connect to server. Even all that "imports" do not help. The Code:</p>
  
  <pre><code>import flash.system.Security;
  import flash.net.XMLSocket;
  import flash.events.Event;
  import flash.events.IOErrorEvent;
  import flash.events.SecurityErrorEvent;
  import flash.events.DataEvent;
  
  var xmlSocket:XMLSocket = new XMLSocket();
  xmlSocket.connect("myserverhost", 88);
  
  xmlSocket.addEventListener(DataEvent.DATA, onIncomingData);
  send_btn.addEventListener(MouseEvent.CLICK, clickHandler);
  disconnect_btn.addEventListener(MouseEvent.CLICK, disconnectHandler);
  
  function clickHandler(event:MouseEvent):void
  {
      xmlSocket.send(input_txt.text);
      input_txt.text = "";
  }
  
  function disconnectHandler(event:MouseEvent):void
  {
      xmlSocket.close();
      send_btn.enabled = false;
  }
  
  function onIncomingData(event:DataEvent):void
  {
      var items:Object = JSON.decode(event.data);
      for (var index in items) {
          trace(index+" =&gt; "+items[index]);
      }
  
      if(items['hello']){
          output_txt.text += items['hello'] + "\n";
      }
      else if(items['description']){
          output_txt.text += items['description'] + "\n";
      } else {
          output_txt.text += event.data + "\n";
      }
  
  
      output_txt.verticalScrollPosition = output_txt.maxVerticalScrollPosition;
  }
  </code></pre>
  
  <p>I have been googling and found advise to make a crossdomain.xml file but it does not work, this is it:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd"&gt;
  &lt;cross-domain-policy&gt;
    &lt;allow-access-from domain="*" to-ports="*" secure="false"/&gt;
  &lt;/cross-domain-policy&gt;
  </code></pre>