这个是经常使用到的一个控件 这个例子就是从一个XMLLIST中取得数据然后并获取他 <?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"> <s:layout> <s:BasicLayout/> </s:layout> <fx:Script> <!--[CDATA[ import mx.events.FlexEvent; import spark.events.IndexChangeEvent; protected function DropDownList1_changeHandler(event:IndexChangeEvent):void { showString(); } protected function ddlist_initializeHandler(event:FlexEvent):void { showString(); } protected function showString():void { myString.text = ddlist.selectedItem.name + "/n"; myString.text += ddlist.selectedItem.phone + "/n"; myString.text += ddlist.selectedItem.email; } ]]--> </fx:Script> <fx:Declarations> <s:XMLListCollection id="eList" > <fx:XMLList> <employee> <name>刘德华</name> <phone>555-219-2270</phone> <email>liudehua@qq.com</email> </employee> <employee> <name>张曼玉</name> <phone>555-219-2012</phone> <email>zhangmanyu@qq.com</email> </employee> <employee> <name>郭富城</name> <phone>555-219-2012</phone> <email>guofucheng@qq.com</email> </employee> <employee> <name>赵薇</name> <phone>555-219-2000</phone> <email>zhaowei@qq.com</email> </employee> </fx:XMLList> </s:XMLListCollection> </fx:Declarations> <s:DropDownList id="ddlist" x="83" y="46" dataProvider="{eList}" labelField="name" selectedIndex="1" change="DropDownList1_changeHandler(event)" initialize="ddlist_initializeHandler(event)"/> <s:Label id="myString" x="83" y="91" width="449" height="199" color="#FF0000" fontWeight="bold" fontSize="36"/> </s:Application>