-
XML code works when exporting swf, but not when i open it.
Hello everyone, this is my first post here. I was making my website on flash, and to load my feed from twitter i used this code.
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.text.TextFormat;
stop();
const USERNAME:String = "NunoAlvaresVFX"
const FONT:String = "Calibri";
const SIZE:int = 12;
var url = "https://api.twitter.com/1/statuses/user_timeline.rss?screen_name="+USERNAME;
var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load(new URLRequest(url));
myXMLLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void{
myXMLLoader.removeEventListener(Event.COMPLETE, processXML);
var myXML:XML = new XML(e.target.data);
var posts:XMLList = myXML.channel.item;
var tf: TextFormat = twitter_post1.length > 0 ? twitter_post1.getTextFormat(0, 1) : twitter_post1.getTextFormat();
twitter_post1.text = posts[0].title + " " + posts[0].pubDate;
twitter_post1.setTextFormat(tf);
twitter_post2.text = posts[1].title + " " + posts[1].pubDate;
twitter_post2.setTextFormat(tf);
twitter_post3.text = posts[2].title + " " + posts[2].pubDate;
twitter_post3.setTextFormat(tf);
}
Don't get me wrong, the code is fully operation, when i export the swf with ctrl+enter it loads the tweets is supposed to.
But once i try to open the swf from the outside (file explorer) it doesn't load them anymore. Can anyone help me please?
Thanks very much.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|