# Another crossdomain.xml problem, VERY STICKY ONE!

**URL:** <https://forum.kirupa.com/t/another-crossdomain-xml-problem-very-sticky-one/302924>\
**Category:** flash\
**Created:** [January 10, 2010, 10:00am UTC](https://forum.kirupa.com/t/another-crossdomain-xml-problem-very-sticky-one/302924 "2010-01-10T10:00:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nizzydaddy](https://avatars.discourse-cdn.com/v4/letter/n/a6a055/32.png) [@nizzydaddy](https://forum.kirupa.com/u/nizzydaddy)\
**Post date:** [January 10, 2010, 10:00am UTC](https://forum.kirupa.com/t/another-crossdomain-xml-problem-very-sticky-one/302924/1 "2010-01-10T10:00:17Z")

</div>

I have the crossdomain.xml in domain root.  
It’s readable and valid.  
I am using port 80.

In AS3, I am using:  
Security.loadPolicyFile(“[http://www.site.com/crossdomain.xml](http://www.site.com/crossdomain.xml)”);

\<?xml version=“1.0” encoding=“UTF-8”?\>  
\<!DOCTYPE cross-domain-policy SYSTEM “[http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd](http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd)”\>  
\<cross-domain-policy\>  
\<allow-access-from domain="_" to-ports="_" /\>  
\<site-control permitted-cross-domain-policies=“master-only”/\>  
\</cross-domain-policy\>

I still get the following error when I run flash in Adobe flash CS4. Also, it doesn’t work from web either. All params are correct. Flash loads. etc.

I did this too:  
In the Flash editor, File-\>Publish Settings… click on the Flash tab and change Local playback security to Access Network Only.

I read zillions of posts online, but still helpless…any more idea? thank you.

securityErrorHandler: [SecurityErrorEvent type=“securityError” bubbles=false cancelable=false eventPhase=2 text=“Error #2048: Security sandbox violation: file:///C|/Users/me.Desktop/me.swf cannot load data from [www.site.com:80](http://www.site.com:80).”]

This is my code:

package {  
import flash.display.Sprite;

```
public class HttpRequestor extends Sprite {
    public function HttpRequestor() {
        var socket:CustomSocket=new CustomSocket("www.site.com",80);
    }
}

```

}

import flash.errors._;  
import flash.events._;  
import flash.net.Socket;  
import flash.net.sendToURL;  
import flash.net.URLRequest;  
import flash.system.Security;

Security.loadPolicyFile(“[http://www.site.com/crossdomain.xml](http://www.site.com/crossdomain.xml)”);  
[//Security.allowDomain](https://Security.allowDomain)("_");  
 [//Security.allowInsecureDomain](https://Security.allowInsecureDomain)("_");

class CustomSocket extends Socket {  
private var response:String;

```
public function CustomSocket(host:String = null, port:uint = 0) {
    super(host, port);
    configureListeners();
}

private function configureListeners():void {
    addEventListener(Event.CLOSE, closeHandler);
    addEventListener(Event.CONNECT, connectHandler);
    addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
    addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
    addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);
}

private function writeln(str:String):void {
    str+="

```

";  
try {  
writeUTFBytes(str);  
} catch (e:IOError) {  
trace(e);  
}  
}

```
private function sendRequest():void {
    trace("sendRequest");
    response="";
    writeln("GET /");
    flush();
}

private function readResponse():void {
    var str:String=readUTFBytes(bytesAvailable);
    response+=str;
}

private function closeHandler(event:Event):void {
    trace("closeHandler: " + event);
    trace(response.toString());
}

private function connectHandler(event:Event):void {
    trace("connectHandler: " + event);
    sendRequest();
}

private function ioErrorHandler(event:IOErrorEvent):void {
    trace("ioErrorHandler: " + event);
}

private function securityErrorHandler(event:SecurityErrorEvent):void {
    trace("securityErrorHandler: " + event);
}

private function socketDataHandler(event:ProgressEvent):void {
    trace("socketDataHandler: " + event);
    readResponse();
}

```

}
