Accessibility

Table of Contents

Deploying a Flex application with ColdFusion URL variables

Configuring the data return type

As mentioned in the introduction, this tutorial uses the same development environment as the Getting started with ColdFusion and Flash Builder 4 beta tutorial and the other tutorials in this series. In this section, you will name a second data type for use with a different service call to a CFC function.

  1. Locate the Data/Services view in Flash Builder 4 beta. You should see the F4CF_Getting_Started_Service service shown in Figure 2.

    Verify whether the EmployeeSalesData data type has been defined.

    Figure 2. Verify whether the EmployeeDataByRegion data type has been defined.

  2. Expand the Data Types category. If you see the EmployeeDataByRegion data type listed (also shown in Figure 2), then you can skip to the next section, Creating the application with a column chart.

If you do not see the data type, follow the steps below to assign your own data type name to the returned data that is retrieved in the getAllData() service call to the CFC method.

  1. In the Data/Services panel, right-click the getEmployeeDataByRegion() function of the F4CF_Getting_Started_Service and select Configure Return Type to open the Configure Operation Return Type dialog box (see Figure 3).

    Configure the return type of getAllData()
function.

    Figure 3. Configure the return type of the getEmployeeDataByRegion() function.

    Each record from the query has been placed in an ActionScript object with each column of data (FIRSTNAME, LASTNAME, EMAIL, and so on) set in a name/value pair. Each record is indexed starting at zero.

    Note: Unlike ColdFusion, ActionScript is a zero-indexed language.

    Rather than generically referring to this returned data as an object, this wizard lets you give the data a return type name. You will do this next.

  2. In the Configure Operation Return Type dialog box, create a new custom data type named EmployeeDataByRegion (see Figure 4).

    Create a new custom data type.

    Figure 4. Create a new custom data type.

  3. Click Next.
  4. In the Create New Data type dialog box, in the Enter Value column, type Central (see Figure 5).

    Entering a region value

    Figure 5. Enter a region value.

  5. Click the Yes radio button to specify that the operation needs remoting credentials.
  6. Enter your username and password in the Remote Service Authentication window (see Figure 6).

    Figure 6. Enter the remoting credentials for the ColdFusion RDS server.

  7. Click OK, and then Next.
  8. Click Finish.

You will see the EmployeeDataByRegion data type listed in the Data Types category of the Data/Services view (see Figure 7). Note that the properties of the data type are the query columns returned from the CFC method.

The data type and its properties

Figure 7. The data type and its properties

The data returned from the CFC contains employee information that is associated with a region: Northwest, Southwest, Central, Northeast, and Southeast. Later in this tutorial, you will learn more about passing dynamic data to Flash applications. For now, you will hard-code the region value.