Accessibility

Table of Contents

Building a Server Dashboard Application with ColdFusion-Powered Flex

ColdFusion as a Flex Back End

So, Flex developers write MXML code to render user interfaces, and rely on external systems for any and all transactions, business logic, and back-end processing. How does Flex access these external systems? Flex provides tags that developers can use to:

  • Invoke web services
  • Make HTTP requests
  • Call remote Java objects

It is worth noting that Flex itself does not really invoke web services or make HTTP calls or call remote Java objects, Flash does that. Flex generates a complete Flash application—a SWF file which runs in Macromedia Flash player—which makes all the back-end calls.

At this point, ColdFusion/Flash integration becomes obvious, Flex calls ColdFusion pages through HTTP requests, or invokes ColdFusion components (CFCs) as web services. You can use any ColdFusion code that you can invoke through HTTP or as a web service within Flex applications. To do this, you don't even have to have ColdFusion installed on the same server as Flex, although that configuration works too.

Application flow with ColdFusion as a Flex back end

Figure 3. Application flow with ColdFusion as a Flex back end

In Figure 3, the flow works something like this:

  1. A user requests a Flex MXML URL.
  2. Flex generates a SWF, which it sends to the user.
  3. The user's Flash player executes the SWF.
  4. The SWF makes HTTP or web service calls from the player and obtains data.
  5. The Flex-generated SWF uses that data on the user's machine.

This type of integration delivers true n-tier applications, and is best suited for actual applications rather than embedded controls, for example.

This integration is also ideal for applications with multiple presentation layers. For example, if you needed a straight HTML version of your application in addition to the more engaging Flex version, you could simply provide multiple presentation interfaces to your back-end code. You would put your application logic, without any UI at all, in ColdFusion components; CFML pages would invoke the CFCs and render the HTML version of the application; and Flex MXML pages would render the Flash version of the application—the bonus is that both use the same back-end code.