10 Replies Latest reply on Jul 2, 2010 11:35 PM by archemedia

    combobox dropdown doesn't refresh

    archemedia Level 4

      Hi all!

       

      I have a comboBox problem. Please test this simple code:

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
          creationComplete="init()">
         
          <mx:Script>
              <![CDATA[
                  import mx.collections.ArrayCollection;
                 
                  [Bindable]
                  private var dp:ArrayCollection;
                 
                  private function init():void
                  {
                      dp = new ArrayCollection(["one", "two"]);
                  }
                 
              ]]>
          </mx:Script>
         
          <mx:ComboBox id="cb" dataProvider="{dp}"/>
          <mx:Button label="click me" click="dp = new ArrayCollection(['three', 'four']);dp.refresh()"/>
      </mx:Application>

       

       

      What happens is that the dropdown list of the combobox doesn't show the new values. I guess I'm overlooking something here.

      Any advice?

       

      Thanks!

       

      Dany