14 Replies Latest reply on Jul 15, 2008 6:45 AM by Developer504

    Getting data from a Combobox

    Developer504 Level 1
      Ok I hit a frustrating little snag with something simple while trying something slightly more complex.

      I created a combo box with some different values, and I want to filter the data in my chart based on the value of this combo box. I thought I had it all figured out and put in my code, but I'm derailed just at the point of getting the data out of the Combo box. It compiles nicely, I see my combobox, my filter string even seems to inherit the value from it initially, but when I make changes to the comb box as a user, it doesn't update my filter string or my data.

      Here is my combo box:

      <mx:ComboBox x="1090" y="10" change="changeEvt(event)">
      <mx:ArrayCollection>
      <mx:Object label="ALL" data="ALL"/>
      <mx:Object label="CM" data="CM"/>
      <mx:Object label="DE" data="DE/"/>
      </mx:ArrayCollection>
      </mx:ComboBox>

      Simple enough.

      Here is my change event:

      private function changeEvt (event:Event):void {
      filter1=event.currentTarget.selectedItem.label
      xmlListColl.refresh();
      }

      I thought this changeEvt would trigger whenever the Combo Box value was changed and update my filter string (filter1). What am I doing wrong?

      M.