2014-10-03 69 views
0

XML結果那是我的XML結果:檢索使用ActionScript

<?xml version="1.0" encoding="iso-8859-1"?> 
<data> 
    <row> 
     <used>1</used> 
    </row> 
</data> 

而且我試圖檢索使用的代碼是這樣的值:

private function onResult(param1:ResultEvent) : void 
{ 
    var result:Object = param1.result.data.row[0]; 
    Alert.show(result.used); 
} 

但它似乎不工作如預期的那樣...

謝謝!

+1

? – Marcela 2014-10-03 21:17:50

回答

0

試試這個:

XML:

<?xml version="1.0" encoding="utf-8"?> 
<data> 
    <row> 
     <used TITLE="your trace should show --> image1">image1.jpg</used> 
     <used TITLE="your trace should show --> image2">image2.jpg</used> 
     <used TITLE="your trace should show --> image3">image3.jpg</used> 
</row> 
</data> 

ActionScript3的:你在使用加載XML

var myXML:XML; 
var myLoader:URLLoader = new URLLoader(); 
myLoader.load(new URLRequest("your_xml.xml")); 
myLoader.addEventListener(Event.COMPLETE, processXML); 

function processXML(e:Event):void { 
    myXML = new XML(e.target.data); 
    trace(myXML.row.used[0][email protected]); //this how to get the first value from your xml used[0] 
}