actionscript 3 - Flash object cannot connect to remote server -
my company design digital signage solutions companies. animated widgets typically produced in flash.
in current project i'm experiencing bit of odd issue. screen split 3 areas: video, rss ticker, , weather. rss , weather objects created using flash. each object it's own flash file.
both flash object utilize same method connect remote servers:
function loadweatherfromurl():void { var urlrequest:urlrequest = new urlrequest("my url"); var urlloader:urlloader = new urlloader(); urlloader.addeventlistener(event.complete, completehandler); try{ urlloader.load(urlrequest); } catch (error:error) { trace("cannot load : " + error.message); } } function completehandler(event:event):void { var loader:urlloader = urlloader(event.target); //do stuff data... }
when testing in ide, both weather object , rss object work fine, seen below:
once deployed signage software doesn't work anymore. however, weather object works expected. flash object doesn't encounter url loading error either. compare pic #2 , pic #3 see how view errors.
if try preview both weather object , rss object locally in web-browser (ie, firefox), local permission errors, expected.
so ideas why 1 work , other wouldn't? if had cors (cross origin resource sharing) wouldn't both fail? have tried both options (local / network only) in publish -> playback settings.
the weather object powered yahoo:
and rss object powered ctv news (canadian television network):
edit:
for rss feed (above used weather object's methods, they're identical except function name , error output) have following:
at run time
error_msg.text = "loading...";
then url loading:
function loadfeedfromurl():void { var urlrequest:urlrequest = new urlrequest("http://ottawa.ctvnews.ca/rss/ctv-news-ottawa-1.1245493"); error_msg.text = ""; var urlloader:urlloader = new urlloader(); urlloader.addeventlistener(event.complete, completehandler); try{ urlloader.load(urlrequest); } catch (error:error) { trace("cannot load : " + error.message); error_msg.text = error.message; } }
edit #2
here updated loading function, basic error handling functions.
function loadfeedfromurl():void { var urlrequest:urlrequest = new urlrequest("http://ottawa.ctvnews.ca/rss/ctv-news-ottawa-1.1245493"); var urlloader:urlloader = new urlloader(); urlloader.addeventlistener(event.complete, completehandler); try{ urlloader.load(urlrequest); } catch (error:error) { trace("cannot load : " + error.message); error_msg.text = error.message; } urlloader.addeventlistener(ioerrorevent.io_error, ioerrorhandlerfunction); urlloader.addeventlistener(ioerrorevent.network_error, ioerrorhandlerfunction); urlloader.addeventlistener(securityerrorevent.security_error, securityerrorhandlerfunction); } function ioerrorhandlerfunction() { error_msg.text = "io error!"; } function securityerrorhandlerfunction() { error_msg.text = "security error!"; }
the error_msg textfield stays "loading...", doesn't appear of error types being received.
Comments
Post a Comment