7.1. AMF/Remoting

ActionScript Message Format (AMF) is a data format that transfers data as binary, which is smaller and faster than other data transfer formats. AMF is a proprietary format created by Macromedia and now owned by Adobe and used in many of their product lines including ColdFusion, which will be demonstrated in this chapter.

7.1.1. ColdFusion

Starting with version 7.02, ColdFusion has supported the ability of a CFC (ColdFusion Component) to be called directly from Flex, with data transport occurring over the very speedy AMF format. The following example demonstrates how to connect to a ColdFusion server from AIR via the <mx:RemoteObject> tag using RPC (Remote Procedure Calls). For this example, you will need a ColdFusion server. A free developer version can be downloaded from Adobe.com.

This example includes two ColdFusion components. The first is the main access point in which AIR will communicate, and the second is a value object, which will demonstrate how server-side ColdFusion objects can be mapped to ActionScript objects. Please follow these steps to get the backend ColdFusion files created.

  1. Create a new directory directly under the root of your ColdFusion 7.02 or later server, and name it beginningAIR. Within that folder, create a new directory named business. So far your directory structure should look like Figure 7-1.

    Figure 7-1. The directory structure under the root of the ColdFusion server.
  2. Now create a new file within the business directory, and name ...

Get Beginning Adobe® AIR™: Building Applications for the Adobe Integrated Runtime now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.