Accessibility

Table of Contents

Generating ColdFusion forms with Adobe Flash Builder 4 beta

Configuring data return type

As mentioned in the introduction, this tutorial uses the same development environment as Getting started with ColdFusion and Flash Builder 4 beta and the other tutorials in this series:

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

    Verify whether the EmployeeSalesData data type has been defined.

    Figure 1. Verify whether the EmployeeSalesData data type has been defined.

  2. Expand the Data Types category. You may see up to two data types listed depending on which tutorials you have completed in this series. Note whether the EmployeeSalesData data type is present.

Follow the steps below to assign your own data type name to the returned data that is retrieved in the getItem() service call to the CFC method:

  1. In the Data/Services view, right-click the getItem() function and select Configure Return Type (see Figure 2).

    Configure the return type of
getItem()  function.

    Figure 2. Configure the return type of getItem() function.

    Each record from the query will be 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 the returned data as an object, the wizard lets you to give the data a return type name.

  2. If the EmployeeSalesData data type does not exist, then, in the Configure Operation Return Type dialog box, create a new custom data type named EmployeeSalesData. If the EmployeeSalesData data type already exists, then click the radio button next to Use an existing ActionScript or custom data type and select EmployeeSalesData[] from the popup list (see Figure 3). Also select the Update selected custom data type check box.

    Create a new custom data type.

    Figure 3. Either create a new custom data type or use an existing one.

  3. Click Next.
  4. In the Create New Data Type dialog box, enter 100001 in the Enter Value field (see Figure 4).

    Populate the Enter Value field with an
employee last name.

    Figure 4. Populate the Enter Value field with an employee last name.

  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 5).

    Enter the remoting credentials for the getAllData() CFC function.

    Figure 5. Enter the remoting credentials for the getAllData() CFC function.

  7. Click OK.
  8. Click Next.

    Note: If you have stepped through the Managing Data with Adobe Flash Builder 4 beta tutorial and you delete the first employee in the database (Allen Sman), then you will get an error message that states, "The operation returned a response of the type 'Object'." In this case, use another value, such as 100002 or 100003, which is the primary key for another employee.

  9. In the Modify Properties of Return Type dialog box, click Finish.

You will see the EmployeeSalesData() data type listed after the getItem() service operation (see Figure 6). Note that the properties of the data type are the query columns returned from the CFC method.

The data type and its properties.

Figure 6. The data type and its properties.