Ok. This is a head scratcher. Why would a root relative path cause a Security Sandbox error.. but an absolute path to the exact same path work fine..
the setup is this..
swf is located on say ..
http://sub.mydomain.com/static/flash/
the html is targeting the swf like so .. /static/flash/my.swf
the html is passing a flashvars like so .. apiPath=/blah/api/
and in the actionscript we have ..
ActionScript Code:
var _url = apiPath+"some/other/?stuff=forauthentication";
var _req = new URLRequest(_url);
_reg.method = "POST";
_req.data = additionalDataToSend_obj;
var _loader = new URLLoader();
_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, catchIt);
_loader.load(_req);
function catchIt(evt:SecurityErrorEvent){
error_txt.text = evt;
}
now the issue is when it uses a root relative path. to send the data. It causes a security sandbox error "Error:2048".. but no explanation included .. like it usually does.
BUT..
when you include the domain as part of the path, everything works as expected.
ActionScript Code:
var domain = flashVars.url.match(/(http|https).*?\.(com|net|org)/)[0];
// returns the exact subdomain that everything is hosted on.
var _url = domain+apiPath+"some/other/?stuff=forauthentication";
There is no cross domain issue. But it almost appears like URLLoader is not retaining the proper domain when using a root relative path.
is this a known bug or are we just missing something.
The issue is resolved. I'm just trying to understand why there would be a 'generic sandbox error' if everything is on the same domain.