Avatar

Correct answer by
Level 4

If this post answers your querstion or helps, please mark it as such.

First, use XMLListCollection for the data for the ConboBox and for the Muni result handler xlcMuni (instead of acMuni).

Here is a simplified version of your app with the answer. It uses e4x syntax for filtering.

http://livedocs.adobe.com/flex/3/html/help.html?content=13_Working_with_XML_03.html

--------------- CityNames.xml ----------------

<?xml version="1.0" encoding="utf-8"?>
<CITIES>
  <city>Chicago</city>
  <city>New York</city>
  <city>Boston</city>
</CITIES>

---------- GetAllMunis.xml ------------

<?xml version="1.0" encoding="utf-8"?>
<MUNIS>
  <muni>
    <city>Chicago</city>
    <year>1866</year>
  </muni>
  <muni>
    <city>New York</city>
    <year>1872</year>
  </muni>
  <muni>
    <city>Boston</city>
    <year>1756</year>
  </muni>
</MUNIS>

------------- MainApp.mxml -------------------

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  creationComplete="muniHS.send();cityHS.send();">
  <mx:Script>
    <![CDATA[
      import mx.events.ListEvent;
      import mx.rpc.events.*;
      import mx.controls.*;
      import mx.charts.*;
      import mx.collections.*;
 
      [Bindable] private var xlcMuni:XMLListCollection = new XMLListCollection;
      [Bindable] private var xlcCity:XMLListCollection = new XMLListCollection;
      [Bindable] private var xlcDG:XMLListCollection = new XMLListCollection;
 
      private function eHandler(e:ResultEvent):void {
        this.xlcMuni = new XMLListCollection(e.result..muni);
      }
 
      private function eCityHandler(e:ResultEvent):void {
        this.xlcCity = new XMLListCollection(e.result.city);
      }
     
      private function populateDG(evt:ListEvent):void{
        var temp:XMLList = xlcMuni.copy();
        xlcDG = new XMLListCollection(temp.(city == ComboBox(evt.currentTarget).selectedItem));
      }
    ]]>
  </mx:Script>
  <mx:HTTPService id="muniHS" resultFormat="e4x"
    url="data/GetAllMunis.xml" useProxy="false"
    result="eHandler(event)"/>
  <mx:HTTPService id="cityHS" url="data/CityNames.xml"
    resultFormat="e4x" result="eCityHandler(event)"/>
  <mx:Panel width="100%" height="50%" title="DataGrid">
    <mx:ComboBox id="muniCB" dataProvider="{xlcCity}"
      prompt="Select a Municipality" labelField="city"
      change="populateDG(event)"/>
    <mx:DataGrid id="dg" width="100%" height="100%"
      dataProvider="{xlcDG}">
      <mx:columns>
        <mx:DataGridColumn headerText="municipality" dataField="city"/>
        <mx:DataGridColumn dataField="year"/>
      </mx:columns>
    </mx:DataGrid>
  </mx:Panel>
</mx:Application>

View solution in original post