这是使用 xml 从 Twitter Feed 中提取数据,它运行良好,但我无法提取第一个数据?
trace(wordList[0]) 始终未定义
如果我想添加我写这个的日期:
childItems[i].childNodes[0].firstChild.nodeValue
如何将其推送到数组?
var wordList:Array = new Array();
var curIndex:Number = 0;
var reviews_xml:XML = new XML();
reviews_xml.ignoreWhite = true;
reviews_xml.onLoad = function (success:Boolean):Void {
if (success) {
var childItems:Array = reviews_xml.firstChild.childNodes;
for (var i:Number = 0; i < childItems.length; i++) {
wordList.push(childItems[i].childNodes[2].firstChild.nodeValue);
}
resimAlanim.loadMovie(childItems[0].childNodes[9].childNodes[5].firstChild.nodeValue);
} else {
trace("yüklenemedi");
}
}
setInterval( showNextText, 3000 );
function showNextText()
{
curIndex++;
renderText(curIndex);
if((curIndex )== wordList.length){
curIndex = 0;
renderText(curIndex);
};
}
function renderText( index:Number )
{
text_mc.text = wordList[index];
trace(index);
}
reviews_xml.load("https://api.twitter.com/1/statuses/user_timeline.xml?include_entities=false&include_rts=true&screen_name=twitter&count=5");
renderText(curIndex);
stop();