I have a problem with loading data from my PHP server. I can access it simply by link but in actionscript when I'm trying to load it just like in this thread: Get and parse JSON in Actionscript it is not working.
It just throws an event
[SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048"].
What should I do? I've read something about cross-domain-policy so I have added file crossdomain.xml to PHP server like this:
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*"/>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
I tried adding this file almost everywhere. Can I do something more?
Code responsible for loading this data:
private function getURL():void
{
var request:URLRequest=new URLRequest("http://Journey.pe.hu/Journey/Users/");
ExternalInterface.call("console.log", request.url);
request.requestHeaders=[new URLRequestHeader("Content-Type", "application/json")];
request.method=URLRequestMethod.GET;
var loader:URLLoader=new URLLoader();
loader.addEventListener(Event.COMPLETE, receive);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, notAllowed);
loader.addEventListener(IOErrorEvent.IO_ERROR, notFound);
loader.load(request);
ExternalInterface.call("console.log", "l1");
}
protected function notAllowed(event:SecurityErrorEvent):void
{
ExternalInterface.call("console.log", event.toString());
}
protected function notFound(event:IOErrorEvent):void
{
ExternalInterface.call("console.log", "NOT FOUND");
}
protected function receive(event:Event):void
{
ExternalInterface.call("console.log", "Nameldasodoad");
var loader:URLLoader = URLLoader(event.target);
var jsonArray:Array = com.adobe.serialization.json.JSON.decode(loader.data);
//ExternalInterface.call("console.log", "Name " + jsonArray[0].Name);
//var jsonArray:Array = com.adobe.serialization.JSON.decode(loader.data);
}