Spark ComboBox新功能

       在spark组件中ComboBox增加了prompt属性,类似于在选择框增加一个提示信息,例如 “--请选择--”,但是adobe还增加了一个更加实用的功能,ComboBox可以输入文字进行过滤列表,匹配上的会着色加重显示。

       简单的例如代码如下:

      

<?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">
	<fx:Declarations>
		<!-- 将非可视元素(例如服务、值对象)放在此处 -->
	</fx:Declarations>
	<s:layout>
		<s:VerticalLayout paddingLeft="20" paddingRight="20"/>
	</s:layout>
	<s:Label text="The selected index is: {myCB.selectedIndex}"/>
	<s:Label text="The selected item is: {myCB.selectedItem}"/>
	<s:ComboBox id="myCB" width="140" prompt="Select a Color">
		<s:dataProvider>
			<mx:ArrayList>
				<fx:String>Red</fx:String>
				<fx:String>Orange</fx:String>
				<fx:String>Yellow</fx:String>
				<fx:String>Blue</fx:String>
				<fx:String>Green</fx:String>
			</mx:ArrayList>
		</s:dataProvider>
	</s:ComboBox>
</s:Application>

 

 

    过滤效果见下图

 

    Spark ComboBox新功能

    

你可能感兴趣的:(combobox)