XMLSocket, "Error #2048: Security sandbox violation"

I’m attempting to create an XMLSocket that connects to a PHP-written socket server.

I think my code is pretty sound. I used to receive an IOError, but now that is solved and I keep receiving “Error #2048: Security sandbox violation”. My .swf, socket server, and crossdomain files are all in the same directory.

My ActionScript:

    import flash.display.MovieClip;
    import flash.events.IOErrorEvent;
    import flash.events.Event;
    import flash.net.XMLSocket;
    import flash.text.*;
    import flash.events.ProgressEvent;
    import flash.events.SecurityErrorEvent;
    import flash.system.Security;
    public class XMLSocketTest extends MovieClip
        public function XMLSocketTest():void
            socket = new XMLSocket();

            socket.addEventListener(IOErrorEvent.IO_ERROR, traceError);
            socket.addEventListener(Event.CONNECT, connectionHandler);
            socket.addEventListener(ProgressEvent.PROGRESS, progressHandler);
            socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
            socket.connect("My IP Address", 9001);
        private var socket:XMLSocket;
        private function progressHandler(event:ProgressEvent):void
            tracer.text = String(event.bytesLoaded / event.bytesTotal);
        private function securityErrorHandler(event:SecurityErrorEvent):void
            tracer.text = event.text;
        private function traceError(event:IOErrorEvent):void
            tracer.text = event.text;
        private function connectionHandler(event:Event):void
            tracer.text = "Great success!";

The PHP Socket Server:

// Set time limit to indefinite execution
set_time_limit (0);

// Set the ip and port we will listen on
$address = 'My IP Address';
$port = 9001;

// Create a TCP Stream socket
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
// Bind the socket to an address/port
socket_bind($sock, $address, $port) or die('Could not bind to address');
// Start listening for connections

/* Accept incoming requests and handle them as child processes */
$client = socket_accept($sock);

// Read the input from the client, up to 1024 bytes
$input = socket_read($client, 1024);

// Strip all white spaces from input
$output = ereg_replace("[ 	

// Display output back to client
socket_write($client, $output);

// Close the client (child) socket

// Close the master sockets

The crossdomain policy file:

<?xml version="1.0"?> 
<!-- --> 
<allow-access-from domain="*" to-ports="*" /> 

Any help or advice would be much appreciated.