<?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" > <fx:Script> <![CDATA[ private var _selectedIndex:int; private function onChange(event:Event):void { if (event.target.selectedIndex == -3) { event.target.selectedIndex = _selectedIndex; } else { _selectedIndex = event.target.selectedIndex; } } ]]> </fx:Script> <s:layout> <s:VerticalLayout paddingTop="5" paddingLeft="5"/> </s:layout> <s:Label text="The selected index is: {myCB.selectedIndex}"/> <s:Label text="The selected item is: {myCB.selectedItem}"/> <s:Label id="test" text="xxxx"/> <s:ComboBox id="myCB" width="140" prompt="Select a Color" change="onChange(event)"> <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>
How to test. Select a value from the combo. Highlight the selected value and type 123 in. After that hit a Tab. As you can see the value that was there before you typed in is restored. Now, repeat previous step again. When you try typing the first character won't be taken. Any explanation/idea? Thanks