Parsed XML Printing Using E4X: Inconsistent Results?
I'm trying to parse an XML file of tweets as retreived from Twitter's restful API (http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-user_timeline). The issue is, when I print it using:
tweetTextArea.text += xml..text;
I get the tweets. However, when I try the following, I get just numbers:
// Print all开发者_JS百科 tweets.
for (var tweet : * in xml..text) {
tweetTextArea.text += tweet;
}
I am seriously perplexed by this. I have scoured the WWW to try and find a decent comprehensive AS3 tutorial and specifically on E4X but haven't found anything that's helping me. I'm sure it's a minor issue.
What is happening?
Can I iterate through the tweets in a for-each loop or do I have to resort to using a standard for loop?
I'm using the code inside a MXML file, and will update with full source if necessary.
Ok, there's a big difference between "for ... in" and "for each ... in" in actionscript. What you're trying to do would probably ask for a "for each" as it iterates through the items of an object/collection rather than properties, like "for" does.
Read more on loops in actionsctipt on: LiveDocs
精彩评论