5 Replies Latest reply on Mar 5, 2010 10:59 PM by Flex harUI

    Why this doesn't show me correct list?

    aurphir Level 1

      The below code shows me labels from the old selected list any ideas?

       

      <?xml version="1.0"?>
      <!-- Simple example to demonstrate the ComboBox control. -->
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
      
           <mx:Script>
                <![CDATA[
                     import mx.collections.ArrayCollection;
      
                     public var ab:ArrayCollection=new ArrayCollection([{label: "A", data: 1},
                          {label: "B", data: 2}]);
                     public var cd:ArrayCollection=new ArrayCollection([{label: "C", data: 3},
                          {label: "D", data: 4}]);
      
                     private function abClick(event:Event):void
                     {
                          cb.dataProvider=ab;
                     }
      
                     private function cdClick(event:Event):void
                     {
                          cb.dataProvider=cd;
                     }
                ]]>
           </mx:Script>
      
           <mx:Panel title="ComboBox Control Example"
                       height="75%"
                       width="75%"
                       layout="horizontal"
                       paddingTop="10"
                       paddingBottom="10"
                       paddingLeft="10"
                       paddingRight="10">
      
                <mx:ComboBox id="cb"
                                width="150"/>
                <mx:Button label="List AB"
                             click="abClick(event);"/>
                <mx:Button label="List CD"
                             click="cdClick(event);"/>
           </mx:Panel>
      </mx:Application>