In this exercise, you will use the Flash Builder Data/Services wizard to connect to a data source and retrieve data for your application.
In Model-View-Controller (MVC) terms, this data is your model and you will bind it to two controls: a DataGrid and a List control (see Figure 1). These two controls are your view. The controller is the main application file, which contains the business logic to manage and display the data.

Figure 1.Review your task for this exercise.
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 use the Flash Builder Data/Services wizard to connect to a website to retrieve XML data.
Select Data > Connect to Data/Service (see Figure 2).

Figure 2. Select Data > Connect to Data/Service.
In the Connect to Data/Service dialog box, select HTTP (see Figure 3).

Figure 3. Click HTTP to select that type of data service.
Your Connect to Data/Services dialog box should appear as shown in Figure 4.

Figure 4. Create a data operation and service name.
Click Finish.
You should see the Data/Services view showing the EmployeeService data service (see Figure 5).

Figure 5. View the EmployeeService data service in the Data/Services view.
In this section, you will define the data type for the data that is returned from the getEmployees() operation.
Right-click the getEmployees() operation and select Configure Return Type (see Figure 6).

Figure 6. Right-click the getEmployees() operation and select Configure Return Type.
In the Configure Return Type dialog box, be sure the radio button Auto-detect the return type from sample data is selected (see Figure 7).

Figure 7. Leave the default settings within the Configure Return Type dialog box.
In the Auto-Detect Return Type dialog box, leave the default settings (see Figure 8).

Figure 8. Leave the default settings for the Auto-Detect Return Type dialog box.
In the Return Type Detected Successfully dialog box, change the root of the properties returned by the operation to employee (see Figure 9).

Figure 9. Select employee as the root of the getEmployees() return type.
Within the Data/Services view, expand the getEmployees() operation. You should see the properties of the employee data displayed (see Figure 10).

Figure 10. View the getEmployees() return type and properties by expanding the getEmployees() method.
In this section, you will use two Flex framework controls to view the returned data. Both controls will access the same data in the model but will display different data in each of their views.
From the Components view Controls branch, drag a DataGrid control and drop it in the Design area (see Figure 11).

Figure 11. Add a DataGrid control to the application.
From the Data/Services view, drag the getEmployees() operation and drop it on the DataGrid control (see Figure 12).

Figure 12. Drag the getEmployees() operation and drop it on the DataGrid control.
Save the file and run the application.
You should see the DataGrid control is populated with employee data (see Figure 13).

Figure 13. Run the application to see the DataGrid control is populated with employee data.
From the Components view Controls branch, drag a paged List control and drop it below the DataGrid control (see Figure 14).

Figure 14. Drag a paged List control and drop it below the DataGrid control.
From the Data/Services view, drag the getEmployees() operation and drop it on the paged List control (see Figure 15).

Figure 15. Drag the getEmployees() operation and drop it onto the paged List control.
You should see the Bind To Data dialog box.
In the List properties section, select firstName from the drop-down list (see Figure 16).

Figure 16. Select firstName for the List control field to display.
With the paged List control selected, use the Properties view to assign a Width of 75 (see Figure 17).

Figure 17. Assign the paged List control a width of 75.
You should see both the DataGrid control and List control are populated with data. Note that the List control only displays the employee's first name.

Figure 18. Run the application to see both controls being used to view the data within the model.
In this exercise, you learned how to use Flash Builder to model data and view it with Flex controls.
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.