ArrayCollection和ComboBox

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
	<mx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			[Bindable]
			private var myDp:ArrayCollection=new ArrayCollection([
				{id:1,fName:"吴1",lName:"1xxyyzz"},
				{id:2,fName:"吴2",lName:"2xxyyzz"},
				{id:3,fName:"吴3",lName:"3xxyyzz"}
			]);
			
			private function getFullName(obj:Object):String{
				return obj.fName+'  '+obj.lName;
			}
			

		]]>
	</mx:Script>
	<mx:ComboBox x="114" y="108" dataProvider="{myDp}" id="cbPeople" labelFunction="getFullName"></mx:ComboBox>
	<mx:Label x="70" y="110" text="{cbPeople.selectedItem.id}"/>
	
</mx:Application>
posted @ 2011-06-13 17:37  庚武  Views(286)  Comments(0Edit  收藏  举报