In this exercise, you will use parameters within an HTTPService object to request specific data (see Figure 1).

Figure 1. Filter the DataGrid control results based on parameters passed to the server from the DropDownList control.
In this exercise, you will learn how to:
In order to complete this tutorial, you need the following software and files:
In this section, you will pass a parameter to the server to return filtered data.
Click the Get Employees Button control. You should see the DataGrid control populate with data (see Figure 2).

Figure 2. Click the Get Employees button to populate the DataGrid control.
DataGrid control.DataGrid control, add a DropDownList control with both opening and closing tags.
...
<mx:DataGridColumn dataField="managerID"/>
</mx:columns>
</mx:DataGrid>
<s:DropDownList>
</s:DropDownList>
<s:Button label="Get Employees"
click="employeeService.send()"/>
...
DropDownList control, assign locationList as the id property:
<s:DropDownList id="locationList"> </s:DropDownList>
DropDownList tags, add a dataProvider property tag block:
<s:DropDownList id="locationList"> <s:dataProvider> </s:dataProvider> </s:DropDownList>
You are going to populate this DropDownList control with static data. Remember that dataProvider properties for List-based controls commonly accept data in the form of an array.
dataProvider tags, add an ArrayList control instance:
<s:DropDownList id="locationList"> <s:dataProvider> <s:ArrayList> </s:ArrayList> </s:dataProvider> </s:DropDownList>
ArrayList control, assign the value All using the String tag set:
<s:DropDownList id="locationList">
<s:dataProvider>
<s:ArrayList>
<fx:String>All</fx:String>
</s:ArrayList>
</s:dataProvider>
</s:DropDownList>
ArrayList tags, below the first string instance, assign the values San Francisco, Chicago, and Los Angeles using separate String instances for each.
<s:DropDownList id="locationList">
<s:dataProvider>
<s:ArrayList>
<fx:String>All</fx:String>
<fx:String>San Francisco</fx:String>
<fx:String>Chicago</fx:String>
<fx:String>Los Angeles</fx:String>
</s:ArrayList>
</s:dataProvider>
</s:DropDownList>Declarations tags below the Declarations comment.HTTPService object, add a request tag set:
<fx:Declarations> <s:HTTPService id="employeeService" url="http://adobetes.com/f4iaw100/remoteData/employeeData.cfm" result="employeeService_resultHandler(event)" fault="employeeService_faultHandler(event)"> <s:request> </s:request> </s:HTTPService> </fx:Declarations>
request tag set, create a location tag set:
<s:HTTPService id="employeeService" url="http://adobetes.com/f4iaw100/remoteData/employeeData.cfm" result="employeeService_resultHandler(event)" fault="employeeService_faultHandler(event)"> <s:request> <location></location> </s:request> </s:HTTPService>
location property to the selected data object of the DropDownList control, locationList.selectedItem:
<s:HTTPService id="employeeService"
url="http://adobetes.com/f4iaw100/remoteData/employeeData.cfm"
result="employeeService_resultHandler(event)"
fault="employeeService_faultHandler(event)">
<s:request>
<location>{locationList.selectedItem}</location>
</s:request>
</s:HTTPService>
DropDownList control.Click the Get Employees button.
You should see the DataGrid control appear populated with the employees located in the city selected in the DropDownList control (see Figure 3).

Figure 3. Select Los Angeles from the DropDownList control and click the Get Employees button to populate the DataGrid control with employees from that location.
In this exercise, you learned how to use an HTTP service request to pass parameters to return filtered data.
request property.dataProvider property.request tag.Trilemetry, Inc is a development and education organization that implements a human-centered design approach to the creation of software and content. Their Adobe portfolio includes the Adobe ColdFusion Getting Started Experience, the Adobe Flex Getting Started Experience, the Flex in a Week video series, the official Adobe instructor-led training course Flex 3: Extending and Styling Components and more. They also create and support many Web applications from interactive Flash sites and corporate web sites to mission-critical business applications.