Thanks for your reply. But I guess setting selectedIndex would not work, as it is quite possible for an extra item to be added in the data and hence the text that was selected might now be 4th instead of 3rd.
I think I might have to use selectedlabel and store it and then compare that text value in dataprovider's data and then set the selectedindex. But is this the standard behavious or combo box i.e it chages the selected item as soon as the dataprovider gets a new set of data? --- In [email protected], "valdhor" <[EMAIL PROTECTED]> wrote: > > Create a variable to hold the current selection index > > private var comboCurrentSelectedIndex:int = -1; > > add a change event to the comboBox > > <mx:ComboBox id="myComboBox" change="myComboBoxChanged()"/> > > keep the selected index current > > private function myComboBoxChanged():void > { > comboCurrentSelectedIndex = myComboBox.selectedIndex; > } > > When the new data comes in, set the selectedIndex of the comboBox to > the saved index > > myComboBox.selectedIndex = comboCurrentSelectedIndex; > > > --- In [email protected], "nehavyas13" <nehavyas13@> wrote: > > > > Hi, > > > > I am using a combo box and its dataprovider is an arrayCollection > > (dp1.arr1, dp1 is a actionscript class and arr1 is a global > > arraycollection for class). The data is refreshed every minute. Hence, > > in the dp1 class, refreshData() method gets called every minute and > > populates a new arraycollection arr2 with the data everytime. And then > > lastly arr1 points to arr2. (ie. in code I write arr1=arr2). This > > works fine. > > > > But the problem is say if I had selected "value 3" in combo box. Now > > when data refreshes and arr1=arr2, the combobox shows "value 1" i.e > > the 1st value in the array. > > > > What I want is the data in the combo box should be refreshed every > > min. and also the selected value should not change. The data is bound > > to change everytime. i.e some values might be deleted and some new > > values might be added. > > > > Can somebody please provide me with an example for this or provide a > > solution to my above problem so that the seleceted value in combo box > > remains same? > > > > > > Thanks > > >

