title: Change handler not triggering the first time in Flex
body: <p>I use a multiple-check Drop-Down which does not trigger the first Change event. Subsequent events trigger properly. When I select Select All or any other option the first time it does not trigger the event either.</p>
  
  <pre><code>use namespace mx_internal;
  
  [Style(name="selectAllBorderAlpha", type="Number", inherit="no", theme="spark, mobile", minValue="0.0", maxValue="1.0")]
  [Style(name="selectAllBorderColor", type="uint", format="Color", inherit="no", theme="spark, mobile")]
  [Style(name="selectAllBorderVisible", type="Boolean", inherit="no", theme="spark, mobile")]
  [Style(name="selectAllBackgroundColor", type="uint", format="Color", inherit="no", theme="spark, mobile")]
  [Style(name="selectAllBackgroundAlpha", type="Number", inherit="no", theme="spark, mobile", minValue="0.0", maxValue="1.0")]
  
  [IconFile("DropDownList.png")]
  
  [DiscouragedForProfile("mobileDevice")]
  public class CheckBoxDropDownList extends CheckBoxDropDownListBase
  {
    public function CheckBoxDropDownList()
    {
      super();
      addEventListener(IndexChangeEvent.CHANGE, indexChangeHandler);
    }
  
    protected function indexChangeHandler(event:IndexChangeEvent):void
    {
      selectedAll = false;
    }
  
    [SkinPart(required="false")]
    public var selectAllCheckBox:CheckBox;
  
    [SkinPart(required="false")]
    public var selectAllHitArea:UIComponent;
  
    [SkinPart(required="false")]
    public var labelDisplay:IDisplayText;
  
    private var labelChanged:Boolean = false;
    private var labelDisplayExplicitWidth:Number; 
    private var labelDisplayExplicitHeight:Number; 
    private var sizeSetByTypicalItem:Boolean;
  
    override public function get baselinePosition():Number
    {
      return getBaselinePositionForPart(labelDisplay as IVisualElement);
    }
  
    private var _prompt:String = "";
  
    [Inspectable(category="General", defaultValue="")]
  
    public function get prompt():String
    {
      return _prompt;
    }
  
    public function set prompt(value:String):void
    {
      if (_prompt == value)
        return;
  
      _prompt = value;
      labelChanged = true;
      invalidateProperties();
    }
  
    [Inspectable(category="Data")]
  
    override public function set typicalItem(value:Object):void
    {
      super.typicalItem = value;
      invalidateSize();
    }
  
    override protected function commitProperties():void
    {
      super.commitProperties();           
  
      if (labelChanged)
      {
        labelChanged = false;
        updateLabelDisplay();
      }
  
      if (selectedAllChanged)
      {
        selectedAllChanged = false;
  
        if (selectAllCheckBox)
        {
          selectAllCheckBox.selected = _selectedAll;
          this.dispatchEvent(new Event("selectAllChanged"));
        }
        invalidateList();
      }
    }
  
    override protected function partAdded(partName:String, instance:Object):void
    {
      super.partAdded(partName, instance);
  
      if (instance == labelDisplay)
      {
        labelChanged = true;
        invalidateProperties();
      }
  
      if (instance == selectAllCheckBox)
      {
        selectedAllChanged = true;
        invalidateProperties();
      }
  
      if (instance == selectAllHitArea)
      {
        selectAllHitArea.addEventListener(MouseEvent.CLICK, selectAllHitArea_clickHandler);
      }
    }
  
    override protected function partRemoved(partName:String, instance:Object):void
    {
      super.partRemoved(partName, instance);
  
      if (instance == selectAllHitArea)
      {
        selectAllHitArea.removeEventListener(MouseEvent.CLICK, selectAllHitArea_clickHandler);
      }
    }
  
    protected function selectAllHitArea_clickHandler(event:MouseEvent):void
    {
      if (selectAllCheckBox)
        selectedAll = !selectAllCheckBox.selected;
    }
  
    private var _selectedAll:Boolean = false;
    private var selectedAllChanged:Boolean;
  
    public function get selectedAll():Boolean
    {
      return _selectedAll;
    }
  
    public function set selectedAll(value:Boolean):void
    {
      if (value == _selectedAll)
        return;
  
      _selectedAll = value;           
      selectedAllChanged = true;
      labelChanged = true;
  
      selectedIndices = Vector.&lt;int&gt;([]);
      //setSelectedItem(undefined, false);
  
      invalidateProperties();
    }
  
    public function setSelectedIndices(selValues:Array):void
    {
      if (this.dataProvider == null) {
        return;
      }
  
      var selIndices:Vector.&lt;int&gt; = new Vector.&lt;int&gt;();
  
      if (selValues == null || selValues.length == 0)
      {
        this.selectedAll = true;
        return;
      }
  
      for(var i:int=0; i &lt; this.dataProvider.length; i++)
      {
        for(var j:int=0; j &lt; selValues.length; j++)
        {
          var obj:Object = this.dataProvider.getItemAt(i);
  
          if(selValues[j] == obj.value || selValues[j] == obj.label)
          {
            selIndices.push(i);   
            break;
          }
        }
      }
  
      if (selIndices.length == 0)
      {
        this.selectedAll = true;
      }
      else
      {
        this.selectedAll = false;
        this.selectedIndices = selIndices; 
      }
    }
  
    override protected function item_mouseDownHandler(event:MouseEvent):void
    {
      if (selectedAll)
      {
        selectedAll = false;
  
        var newIndex:int
        if (event.currentTarget is IItemRenderer)
          newIndex = IItemRenderer(event.currentTarget).itemIndex;
        else
          newIndex = dataGroup.getElementIndex(event.currentTarget as IVisualElement);
  
        var arr:Array = dataProvider.toArray()
        arr.splice(newIndex, 1);
        selectedItems = Vector.&lt;Object&gt;(arr);
  
        return;
      }
      super.item_mouseDownHandler(event);
  
      // if all items are selected, then unselect them and check the "Select All" checkbox.
      if (selectedItems.length == dataProvider.length)
      {
        selectedAll = true;
        selectedIndex = -1;
      }
    }
  
    override protected function dropDownController_closeHandler(event:DropDownEvent):void
    {
      super.dropDownController_closeHandler(event);
  
      // Automatically selected all items if no items are selected when closing the dropDown.
      if (selectedItems.length == 0 &amp;&amp; !selectedAll)
        selectedAll = true;
    }
  
    override protected function measure():void
    {
      var labelComp:TextBase = labelDisplay as TextBase;
  
      // If typicalItem is set, then use it for measurement
      if (labelComp &amp;&amp; typicalItem != null)
      {   
        // Save the labelDisplay's dimensions in case we clear out typicalItem
        if (!sizeSetByTypicalItem)
        {
          labelDisplayExplicitWidth = labelComp.explicitWidth;
          labelDisplayExplicitHeight = labelComp.explicitHeight;
          sizeSetByTypicalItem = true;
        }
  
        labelComp.explicitWidth = NaN;
        labelComp.explicitHeight = NaN;
  
        // Swap in the typicalItem into the labelDisplay
        updateLabelDisplay(typicalItem);
        UIComponentGlobals.layoutManager.validateClient(skin, true);
  
        // Force the labelDisplay to be sized to the measured size
        labelComp.width = labelComp.measuredWidth;
        labelComp.height = labelComp.measuredHeight;
  
        // Set the labelDisplay back to selectedItem
        updateLabelDisplay();
      }
      else if (labelComp &amp;&amp; sizeSetByTypicalItem &amp;&amp; typicalItem == null)
      {
        // Restore the labelDisplay to its original size
        labelComp.width = labelDisplayExplicitWidth;
        labelComp.height = labelDisplayExplicitHeight;
        sizeSetByTypicalItem = false;
      }
      super.measure();
    }
  
    override mx_internal function updateLabelDisplay(displayItem:* = undefined):void
    {
      if (labelDisplay)
      {
        if (displayItem == undefined)
        {
          if (selectedItems != null &amp;&amp; selectedItems.length &gt; 1)
            displayItem = VectorUtils.vectorToArray(selectedItems, Object);
          else
            displayItem = selectedItem;
        }
  
        if (displayItem != null &amp;&amp; displayItem != undefined)
          if (displayItem is Array)
          {
            this.toolTip = selectedItemsToLabel(displayItem, labelField, labelFunction);
            labelDisplay.text = (displayItem as Array).length + " selected";
          }
          else
          {
            this.toolTip = null;                      
            labelDisplay.text = selectedItemsToLabel(displayItem, labelField, labelFunction);
          }
        else if (selectedAll)
          labelDisplay.text = "All";
        else
          labelDisplay.text = prompt;
      }   
    }
  
    private function invalidateList():void
    {
      if (dataGroup == null)
        return;
  
      for each (var itemIndex:int in dataGroup.getItemIndicesInView())
      {
        var renderer:UIComponent = dataGroup.getElementAt(itemIndex) as UIComponent;
        if (renderer)
          renderer.invalidateDisplayList();
      }
    }
  
    private function selectedItemsToLabel(item:Object, labelField:String=null, labelFunction:Function=null):String
    {
      if (labelFunction != null)
        return labelFunction(item);
  
      var collection:ICollectionView = null;
      if (item is Array)
      {
        collection = new ArrayCollection(item as Array);
      }
      else if (item is ICollectionView)
      {
        collection = ICollectionView(item);
      }
      else if (item is IList)
      {
        collection = new ListCollectionView(IList(item));
      }
  
      if (collection != null)
      {
        var itemLabels:Array = [];
        for each (var obj:Object in collection)
        {
          itemLabels.push(obj[labelField]);
        }
        return itemLabels.join(", ");
      }
      return LabelUtil.itemToLabel(item, labelField, labelFunction);
    }
  
    public function get selectedValues():Array
    {
      var arr:Array = [];
  
      if(selectedItems != null &amp;&amp; selectedItems.length &gt; 0)
      {
        for each (var obj:Object in selectedItems)
          arr.push(obj.value);
      }
      return arr;
    }
  
    public function get selectedLabels():Array
    {
      var arr:Array = [];
  
      if(selectedItems != null &amp;&amp; selectedItems.length &gt; 0)
      {
        for each (var obj:Object in selectedItems)
        arr.push(obj.label);
      }
      return arr;
    }
  }
  </code></pre>