Insert value to ComboBox through Cursor : ComboBox « Components « Flex






Insert value to ComboBox through Cursor

Insert value to ComboBox through Cursor
        

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    initialize="initData();">
    <mx:Script>
        
        import mx.collections.*;
        public var myArray:Array = [{label:"A", data:"1"},
                                    {label:"B", data:"2"}, 
                                    {label:"C", data:"3"}];
        [Bindable]
        public var myAC:ArrayCollection;
        public var myCursor:IViewCursor;
        public function initData():void {
            myAC = new ArrayCollection(myArray);
        }
        public function testCollection():void {
            data.myCursor=myAC.createCursor();
            ta1.text="cursor is at: " + myCursor.current.label;

            myCursor.insert({label:"ME", data:"Augusta"});
            ta1.text+="\n cursor is at: " + myCursor.current.label;
        }
      
    </mx:Script>
    <mx:ComboBox id="myCB" rowCount="7" dataProvider="{myAC}" />
    <mx:TextArea id="ta1" height="75" width="350" />
    <mx:Button label="run test" click="testCollection();" />
</mx:Application>

   
    
    
    
    
    
    
    
  








Related examples in the same category

1.ComboBox open/close easing functionComboBox open/close easing function
2.Create ComboBox with static objectsCreate ComboBox with static objects
3.Populating a ComboBox control using variablesPopulating a ComboBox control using variables
4.ComboBox-based custom componentComboBox-based custom component
5.extends the standard ComboBox control to initialize itextends the standard ComboBox control to initialize it
6.Sort ComboBox
7.Set row count for ComboBoxSet row count for ComboBox
8.Use labelFunction to provide label text for ComboBoxUse labelFunction to provide label text for ComboBox
9.Bind Image source to ComboBox
10.Pass in parameter from ComboBox to WebServicePass in parameter from ComboBox to WebService
11.Editable ComboBoxEditable ComboBox
12.Bind ComboBox and TextInput and TextBind ComboBox and TextInput and Text
13.Static ComboBoxStatic ComboBox
14.ComboBox with static String valuesComboBox with static String values
15.Simple ComboBoxSimple ComboBox
16.ComboBox component supports a closeEasingFunction style property.ComboBox component supports a closeEasingFunction style property.
17.Uses the bound propertyUses the bound property
18.Set a labelFunction for a ControlSet a labelFunction for a Control