Or, if you didn't want to get into the "I" interfaces, you could do it simply like this.  This is still data binding, but more of a programmatic hardcoding approach.  Sorry, and thank goodness,  this isn't .NET, but the comboBox does have a selectedIndex property.  BTW, all of this info is in the help docs. ;)

-TH

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml">

   <mx:Script>
        <![CDATA[
            private function addColor():void {
                colorArray.push({label:"Black"});
                messageText.text = "The color Black has been added to the comboBox";
            }
        ]]>
   </mx:Script>

   <mx:VBox  horizontalAlign="center">
       <mx:Label id="messageText"/>
       <mx:HBox>   
           <mx:ComboBox id="cbxColor">
               <mx:dataProvider>
                   <mx:Array id="colorArray">
                       <mx:String>Red</mx:String>
                       <mx:String>Green</mx:String>
                       <mx:String>Blue</mx:String>
                    </mx:Array>
                </mx:dataProvider>
            </mx:ComboBox>
            <mx:Button label="Add Color" click="addColor();"/>
        </mx:HBox>
    </mx:VBox>

</mx:Application>

--- In [email protected], "Michael Schmalle" <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> You can access the comboBox.dataProvider as an ICollectionView.
>
> See the docs about this interface and the IViewCursor
>
> Peace, Mike
>
> On 6/17/06, NZEYIMANA Emery Fabrice [EMAIL PROTECTED] wrote:
> >
> > Hello group,
> >
> > Is there any way of adding an item to the combo box programmatically?
> > I hate data binding and try to avoid it as much as I can.
> > Like in .NET one can access the Items property of the combo box.
> >
> >
> > Thanks
> > Emery
> >
> >
> >
>
>
>
> --
> What goes up, does come down.
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to