loading extermal html into a dynamic text field actionscript3

Tag: flash Author: slim_whitman Date: 2009-07-20

I have a dynamic text field and want to load twitter updates into this in flash using actionscript 3

The dynamic text field is called: myUpdates

Here is the code i have been using but am getting compiler errors saying that String is a static type and instances cannot have members dynamically added to it. I can see what is wrong tho?

    var twitterURL:String ="http://twitter.com/statuses/friends_timeline/19291040.rss";
var twitterXML:URLRequest = new URLRequest(twitterURL);
var myLoader:URLLoader = new URLLoader(twitterXML);
myLoader.addEventListener("complete", xmlLoaded);

function xmlLoaded(evtObj:Event)
    var twitter:XML = new XML(myLoader.data);
    var TwitterTitle:String = twitter.child(0).description;
    var UserUrl:String = twitter.child(0).link;

    var myUpdates:String = "";

    for each (var nodo:XML in twitter..item)
    	myUpdates += ""+nodo.title+"
"+""+nodo.pubDate +"

"; } //The Title App > "Twitter updates " titleApp.text = TwitterTitle; //Display the value of myUpdates into the text field myUpdates.htmlText = myUpdates; //Actions for Follow Me Button followMe_btn.addEventListener(MouseEvent.CLICK, btFollowMe_CLICK); function btFollowMe_CLICK(event:MouseEvent):void { var targetURL:URLRequest = new URLRequest(UserUrl); navigateToURL(targetURL); } }

Other Answer1

myUpdates.htmlText = myUpdates;

Here you grap the local string variable instead of getting the TextField. Simply change the name of the TextField or the local variable, and you should be fine.