actionscript 3 - AdobeFlashCS6 Actionscript3 JSON: Exported SWF and HTML banner don't show JSON information -
i have .swf banner in adobe flashcs6 plays fine, when export ( .swf , .html) banner looses json information taken online json file.
what doing wrong?
actionscript code:
play(); import flash.display.sprite; import flash.events.event; import flash.net.urlloader; import flash.net.urlrequest; var _jsonpath:string = yoururl; function init(e:event = null):void { removeeventlistener(event.added_to_stage, init); var loader:urlloader = new urlloader(); var request:urlrequest = new urlrequest(); request.url = _jsonpath; loader.addeventlistener(event.complete, onloadercomplete); loader.load(request); } init(); function onloadercomplete(e:event):void { var loader:urlloader = urlloader(e.target); var jsonobject:object = json.parse(loader.data); //jsonman.decode(s:string):object trace("loader.data: " + loader.data); trace(jsonobject[3].object.bets[0].title); if(i<10){ country1.text = string(jsonobject[i].object.bets[0].title).touppercase(); country2.text = string(jsonobject[i].object.bets[2].title).touppercase(); country1_odds.htmltext = string("<b>"+ jsonobject[i].object.bets[0].odds + "</b>"); country2_odds.htmltext = string("<b>"+jsonobject[i].object.bets[2].odds + "</b>"); x_odds.htmltext = string("<b>"+jsonobject[i].object.bets[1].odds + "</b>"); var today = new date(); var dd = today.getdate(); var mm = today.getmonth()+1; //january 0! var yyyy = today.getfullyear(); if(dd<10) { dd='0'+dd } if(mm<10) { mm='0'+mm } today = mm+'-'+dd+'-'+yyyy; trace(today); obj_date.htmltext = string("<b>" + jsonobject[i].object.date + "</b>"); i++; if(i==9){ i=0; } } }
edit:
in chrome console says:
failed load resource: net::err_name_not_resolved cloudssl.my.phpcloud.com/super/contentscript.js 2. failed load resource: server responded status of 404 (not found) api.topsport.lt/crossdomain.xml. api.topsport.lt/crossdomain.xml 404 (not found) crossdomain.xml:1
in output receive text:
`typeerror: error #1010: term undefined , has no properties.` `at topsport2_fla::maintimeline/onloadercomplete()` `at flash.events::eventdispatcher/dispatcheventfunction()` `at flash.events::eventdispatcher/dispatchevent()` `at flash.net::urlloader/oncomplete()` `typeerror: error #1010: term undefined , has no properties.` `at topsport2_fla::maintimeline/onloadercomplete()` `at flash.events::eventdispatcher/dispatcheventfunction()` `at flash.events::eventdispatcher/dispatchevent()` `at flash.net::urlloader/oncomplete()`
add listener securityerrorevent:
loader.addeventlistener(securityerrorevent.security_error, securityerrorhandler);
it give error because not have crossdomain policy file. search google - it's simple xml file put on root of server. helps flash know can load resources location.
Comments
Post a Comment