2011-12-10 97 views

回答

1

您應該能夠將XMLList轉換爲XML。
或者:

XML(xml.blah.blah) 

(xml.blah.blah as XML) 
+0

'返回XML(xml.blah.blah);'不起作用?什麼是錯誤? – Cadin

+0

你是對的,我沒有注意到xml.blah.blah.blah 抱歉,我已經標記你的答案是正確的。非常感謝:D – bunnyannihilator89

1

您可以訪問的XMLList的項目,就像您的數組:

var booksXML:XML = 
<Books> 
    <Book ISBN="0000000000"> 
     <title>Title 1</title> 
     <author>Author 1</author> 
    </Book> 
    <Book ISBN="1111111111"> 
     <title>Title 2</title> 
     <author>Author 2</author> 
    </Book> 
    <Book ISBN="2222222222"> 
     <title>Title 3</title> 
     <author>Author 3</author> 
    </Book> 
    <Book ISBN="3333333333"> 
     <title>Title 4</title> 
     <author>Author 4</author> 
    </Book> 
</Books>; 


var authorList:XMLList = booksXML.Book.author; 

for (var i:int = 0; i < authorList.length(); i++) 
{ 
    var authorElement:XML = authorList[i]; 
    trace(authorElement); 
} 
相關問題