I am making a program in which I need to download dynamically generated JSON string and then decode and use it in Flash. When I play swf file, everything goes right, but when I publish it and try to play flash application in .html file it seems like I don't receive any data from server...
var urlString:String = "http://test.hfbiz.cz/utils/parc_coord?param=";
var wholeUrlString:String = urlString + wholeString;
// for example: http://test.hfbiz.cz/utils/parc_coord?param=2:764442_2_709_20
var myRequest:URLRequest = new URLRequest(wholeUrlString);
var myLoader = new URLLoader();
myLoader.addEventListener(Event.COMPLETE, onload);
myLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError);
myLoader.addEventListener(IOErrorEvent.IO_ERROR, IOError);
myLoader.load(myRequest);
...
function onload(evt:Event):void
{
vystup_txt.text = "Data Loaded ";
var kompletParcelyPole:Array = [];
var JSONdata:Object = JSON.parse(myLoader.data);
}
Unfortunately I don't even get my tracing note "Data Loaded" when running in browser... Any ideas what can be done badly?
Everything is OK with your code. I think it is crossdomain issue.
Cross-domain policy errors are always a pain in the ass.