I don't think that is going to work except the first time the method is called. I need to be able add more items to the array later on and this would simply overwrite signalList each time and I'd lose the items added previously.
--- In [email protected], "Mauricio Rogério Obenaus" <[EMAIL PROTECTED]> wrote: > > I had a problem like that, try this: > > var newList:ArrayCollection(signalList); > for (var i:int=0; i<arr.length; i++) { > if (!newList.contains(arr[i].name)) { > newList.addItem(arr[i].name); > } > signalList = newList; > > I din´t compile this, no builder available here. > > > Mauricio > > > > On Fri, Jul 11, 2008 at 12:45 PM, netdeep <[EMAIL PROTECTED]> wrote: > > > > > Here is the relevant code from the component with the combobox: > > > > [Bindable] > > private var signalList:ArrayCollection = new ArrayCollection(); > > > > public function setSignals(sig:ArrayCollection):void { > > signalList = sig; > > } > > > > <mx:ComboBox dataProvider="{signalList}" selectedIndex="0" > > toolTip="{signal.selectedItem.name <http://signal.selecteditem.name/>}" > > change="selectSignal()" > > color="#000000" id="signal" labelField="name"/> > > > > And here is my Application actionscript code for populating signalList: > > > > var arr:Array = archiveList.selectedItems; > > for (var i:int=0; i<arr.length; i++) { > > if (!signalList.contains(arr[i].name)) { > > signalList.addItem(arr[i].name); > > } > > } > > var sort:Sort = new Sort(); > > > > // Set the sort field (case-insensitive) > > sort.fields = [new SortField(null,true)]; > > // Assign the Sort object to the view. > > signalList.sort = sort; > > // Apply the sort to the collection. > > signalList.refresh(); > > > > --- In [email protected] <flexcoders%40yahoogroups.com>, "Alex > > Harui" <aharui@> wrote: > > > > > > Show your code. Last time, someone was inadvertently putting a space > > > into the CB's dataProvider > > > > > > > > > > > > ________________________________ > > > > > > From: [email protected] <flexcoders%40yahoogroups.com> [mailto: > > [email protected] <flexcoders%40yahoogroups.com>] On > > > Behalf Of netdeep > > > Sent: Friday, July 11, 2008 5:48 AM > > > To: [email protected] <flexcoders%40yahoogroups.com> > > > Subject: [flexcoders] combobox fills in with blank element > > > > > > > > > > > > I have an ArrayCollection which is the dataProvider for a combobox in a > > > custom component. > > > However the ArrayCollection is located in the application so I assign it > > > to the custom > > > component via actionscript in the component. > > > > > > When I call addItem on the ArrayCollection the items go into the > > > combobox, however the > > > first element is always blank. How can I can get rid of this and get the > > > combobox to add only > > > the items I am adding to the ArrayCollection? > > > > > > > > > >

