read facebook rss in Flash (cross domain) -
read facebook rss in Flash (cross domain) -
i building application fetches next rss feed , displays it. http://www.facebook.com/feeds/page.php?id=94572408519&format=rss20 works fine locally when uplaod swf online stops working. added crossdomain policy file , doesn't help. odd thing twitter feed loading fine (both locally , online) ideas? code:
override protected function initcontent():void { super.initcontent(); security.allowdomain("https://facebook.com") setcontent("loading data..."); var req:urlrequest = new urlrequest("https://facebook.com/feeds/page.php?id=94572408519&format=rss20"); var l:urlloader = new urlloader(); l.addeventlistener(event.complete, oncontentload); l.addeventlistener(ioerrorevent.io_error, oncontentloaderr); l.load(req); } private function oncontentload(event:event):void { var loadedxml:xml = new xml(event.target.data); //trace(xml.item); loadedxml.ignorewhitespace=true; var len=loadedxml.channel.item.length(); var content:string = ""; (var i:int = 0; < len; i++) { if (loadedxml.channel.item[i].link){ content += "<a href='" + loadedxml.channel.item[i].link + "' target='_blank'>"; content += loadedxml.channel.item[i].title+"</a>"; content += "\n\n"; } } setcontent(content); }
the site hosting web service decides security restrictions service. facebook needs crossdomain.xml in order flash running website connect them.
i built little class work-around flash's restrictions using browser's javascript. loading jsonp has less restrictions flash happy deed proxy flash load cross-domain services client-side.
jsonp.as - http://gist.github.com/1204728
flash facebook rss cross-domain
Comments
Post a Comment