title: Flash cannot setup XMLSocket
body: <p>I just started a project in flash, but it can't startup XMLSocket.</p>
  
  <p>My code:</p>
  
  <pre><code>import Network.CommunicationBootstrap;
  
  var network:CommunicationBootstrap = new CommunicationBootstrap();
  network.start("127.0.0.1", 30000);
  </code></pre>
  
  <p>Package Network classs CommunicationBootstrap:</p>
  
  <pre><code>package Network {
  import flash.net.XMLSocket;
  import flash.events.IOErrorEvent;
  import flash.events.SecurityErrorEvent;
  
  public class CommunicationBootstrap {
  
      private var socket:XMLSocket = new XMLSocket();
  
      public function CommunicationBootstrap() {
          socket.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
          socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
      }
  
      public function start(ip:String, port:int):void {
          this.socket.connect(ip, port);
  
          trace("Testing this out!");
      }
  
      private function ioErrorHandler(event:IOErrorEvent):void {
          trace("ioErrorHandler: " + event);
      }
  
      private function securityErrorHandler(event:SecurityErrorEvent):void {
          trace("securityErrorHandler: " + event);
      }
  
  }
  
  }
  </code></pre>
  
  <p>What my errors are:
  ioErrorHandler: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2031: Socket Error. URL: 127.0.0.1"]
  securityErrorHandler: [SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048: Security sandbox violation: file:///C|/Users/iufrs/Documents/AS3/1/Torn.swf cannot load data from 127.0.0.1:30000."]</p>
  
  <p>(gotten by trace and the 2 events)</p>