make a URLRequest to an external server
I am having an awful time trying to figure out why I am getting Sandbox Security errors when making a request from our game host server to our gamesparks server.
trying to ask gamesparks for a method we made for user name generation
private const GET_NAMES:String = "https://E300018ZDdAx.preview.gamesparks.net/callback/E300018ZDdAx/generateName/YR5w9F53GYeMsP8LTBqijeeAsPM66v7J";
private function getNames():void
{
var postVars:URLVariables = new URLVariables();
postVars.count = 10
var req:URLRequest = new URLRequest(GET_NAMES);
req.method = URLRequestMethod.POST;
req.data = postVars;
var loader:URLLoader = new URLLoader(req);
loader.dataFormat=URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE,check);
loader.addEventListener(IOErrorEvent.IO_ERROR, onError);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
loader.load(req);
}
protected function onSecurityError(event:SecurityErrorEvent):void
{
shellApi.logWWW(event.errorID, event.text);
removeEventHandling(event.target as URLLoader);
}
protected function onError(event:IOErrorEvent):void
{
shellApi.logWWW(event.errorID, event.text);
removeEventHandling(event.target as URLLoader);
}
protected function check(event:Event):void
{
trace(event.data);
removeEventHandling(event.target as URLLoader);
}
private function removeEventHandling(loader:URLLoader):void
{
loader.removeEventListener(Event.COMPLETE, check);
loader.removeEventListener(IOErrorEvent.IO_ERROR, onError);
loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
}
in my searches everything people keep saying its due to our crossdomain.xml, but the game sparks crossdomain.xml we have seems pretty open
https://e300018zddax.preview.gamesparks.net/crossdomain.xml
<cross-domain-policy>
</cross-domain-policy>
they also say stuff like Security.loadPolicyFile(url);, but from what i understand that is only useful if the code is contained in the swf that is on the external game sparks server, but the request i am making is not to load a swf, but to get a json string from gamesparks.
I really don't have a good server background, so assume I know nothing and i am making this up as i go along, because i am.
thanks in advance.
