如何用Flex取xml文件中的值?
我刚开始学flex 想取出xml文件的值
xml文件 名叫testXML.xml
<?xml version="1.0" encoding="UTF-8" ?>
<a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="serverTemplate.xsd">
<students>
<student>
<stuID>1</stuID>
<stuName>张三</stuName>
<stuAge>22</stuAge>
</student>
<student>
<stuID>2</stuID>
<stuName>李四</stuName>
<stuAge>21</stuAge>
</student>
<student>
<stuID>3</stuID>
<stuName>王五</stuName>
<stuAge>23</stuAge>
</student>
<student>
<stuID>4</stuID>
<stuName>赵六</stuName>
<stuAge>24</stuAge>
</student>
</students>
</a>
MXML文件 代码不太会写 我想将xml文件中取出来的值放到下面的label中去 反正就是跟着感觉走 我是这么写的 但是 写到一半不会写了
代码如下
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" initialize="application1_initializeHandler(event)">
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<s:HTTPService id="service" url="assets/testXML.xml" result="httpservice1_resultHandler(event)">
</s:HTTPService>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.ResultEvent;
protected function application1_initializeHandler(event:FlexEvent):void
{
// TODO Auto-generated method stub
service.send();
}
protected function httpservice1_resultHandler(event:ResultEvent):void
{
// TODO Auto-generated method stub
var dp:ArrayCollection = event.result as ArrayCollection;
Alert.show("123");
d1.text= "111111111";
}
]]>
</fx:Script>
<s:ArrayCollection
<s:Label id="d1" x="115" y="82" width="434" height="274">
</s:Label>
</s:Application>
求高手教我怎么写
[解决办法]