<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" creationComplete="application1_creationCompleteHandler()"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<s:layout>
<s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
</s:layout>
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.rpc.events.ResultEvent;
[Bindable]
private var d:XML;
protected function httpservice1_resultHandler(event:ResultEvent):void
{
d=event.result as XML;
trace(d);
t.dataProvider=d;
}
protected function application1_creationCompleteHandler():void
{
http.send();
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<s:HTTPService id="http" url="data/data.xml" resultFormat="e4x" result="httpservice1_resultHandler(event)" />
</fx:Declarations>
<mx:Tree id="t" labelField="@value" width="400" height="300"></mx:Tree>
</s:Application>