My company design digital signage solutions for companies. The animated widgets are typically produced in Flash.
In a current project I'm experiencing a bit of an odd issue. The screen is split into 3 areas: Video, RSS Ticker, and Weather. The RSS and Weather objects are created using Flash. Each object is it's own Flash file.
Both Flash object utilize the same method to connect to the 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 with the data...
}
When testing in the IDE, both the Weather object and the RSS object work fine, as seen below:
Once deployed to the signage software it doesn't work anymore. However, the Weather object works as expected. The Flash object doesn't encounter a URL loading error either. Compare pic #2 and pic #3 to see how I view errors.
If I try to preview both the Weather object and the RSS object locally in a web-browser (IE, Firefox), I do get local permission errors, as expected.
So any ideas why one would work and the other wouldn't? If it had something to do with CORS (Cross Origin Resource Sharing) wouldn't both fail? I have tried both options (local only / network only) in the Publish -> Playback settings.
The weather object is powered by Yahoo:
and the RSS object is powered by CTV News (Canadian Television Network):
EDIT:
For the RSS feed (above I used the Weather object's methods, they're identical except the function name and error output) I have the following:
At run time
error_msg.text = "Loading...";
Then the 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 is the UPDATED loading function, as well as the 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...", so it doesn't appear any of those error types are being received.