I am building an AIR application using AIR 3.1 that is trying to connect to a local http socket using
localhost:7676
The socket is being run from an OSX application on the same computer that the AIR app is trying to connect to using localhost. Upon successful connection the AIR app is supposed to receive a JSON string of data.
When running the swf in a browser, I connect using localhost:7676 there is no issue, it connects successfully to the OSX app running the socket. When the FlashBuilder project is packaged up and compiled as an AIR app, and I connect using the same address, I get this error, and don't know how to resolve...
* Security Sandbox Violation * Connection to localhost:7676 halted - not permitted from app:/Matrx_Remote_App.swf SecurityError: Error #2147: Forbidden protocol in URL localhost:7676
The code that I am using in the class is just a simple loader class
_loader = new URLLoader();
var request:URLRequest = new URLRequest("http://localhost:7676");
_loader.addEventListener(Event.COMPLETE, onComplete);
_loader.addEventListener(IOErrorEvent.IO_ERROR, ioerrorHandler);
_loader.addEventListener(flash.events.HTTPStatusEvent.HTTP_RESPONSE_STATUS, handleOnEventStatus);
_loader.load(request);
And the onComplete method looks like this:
private function onComplete(e:Event):void {
trace("e " + URLLoader(e.target).data + _loader.data + " _loader.bytesTotal " + _loader.bytesTotal);
var loader:URLLoader = URLLoader(e.target);
var jsonData:Object = JSON.parse(loader.data);
trace(jsonData);
}
ANY help on this would be greatly appreciated, thanks!