Adobe
Products
Acrobat
Creative Cloud
Creative Suite
Digital Marketing Suite
Digital Publishing Suite
Elements
Photoshop
Touch Apps
Student and Teacher Editions
More products
Solutions
Digital marketing
Digital media
Education
Financial services
Government
Web Experience Management
More solutions
Learning Help Downloads Company
Buy
Home use for personal and home office
Education for students, educators, and staff
Business for small and medium businesses
Licensing programs for businesses, schools, and government
Special offers
Search
 
Info Sign in
Welcome,
My cart
My orders My Adobe
My Adobe
My orders
My information
My preferences
My products and services
Sign out
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out My orders My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Review and Checkout
Adobe Developer Connection / Flex Developer Center /

Understanding Flex in the client/server model

by Trilemetry

Trilemetry
  • Trilemetry, Inc.

Created

22 March 2010

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
CFC ColdFusion data services Flex

Requirements

User level

All

In this article, you will learn about the Adobe Flash Platform, Adobe Flex and how Flex fits into the world of an Adobe ColdFusion developer. This is a high level discussion that will explain what Flex is and two ways that it is commonly used with ColdFusion.

Understanding the Adobe Flash Platform

The Adobe Flash Platform is an integrated set of technologies for creating rich, compelling applications, content and video. As an experienced web developer, you have probably heard of Adobe Flash and visited sites created with Adobe Flash Professional. However, this tool is only one technology in the platform (see Figure 1).

Adobe Flash Platform technologies
Figure 1. Adobe Flash Platform technologies

You can use any of the professional tools to create rich media, content and applications that are played back in the Flash Player or AIR runtimes. You can also add enterprise-level functionality with the server products, but this is outside the scope of the article.

Let me focus for a minute on the professional tools and web development:

  • Flash Builder has helpful designer-developer workflow tools, but is largely geared towards developer productivity for Flex application development.
  • Flash Catalyst is a new interaction design tool for creating interfaces and content without writing code.
  • Flash Professional is an authoring environment to create content, animation, applications, and more using visual tools, a timeline or programming.

What they all have in common is that they can compile SWF application files (among other file types), which can then be wrapped in HTML and displayed in a browser that has Flash Player installed (see Figure 2).

The Flash Platform tools can compile into SWF files that can then be referenced in your HTML code.
Figure 2. The Flash Platform tools can compile into SWF files that can then be referenced in your HTML code.

Understanding the Flex framework and Flash Builder

Flash Catalyst and Flash Builder are based on the Flex 4 framework, which is a free, open source library of classes and UI components that can greatly improve your ability to create applications that deploy consistently on all major browsers, desktops and operating systems (see Figure 3). Note that the framework provides two programming languages, MXML and ActionScript, which you can learn about in the related article Introducing the MXML and ActionScript Languages.

The Flex framework is a free, open source library.
Figure 3. The Flex framework is a free, open source library.

You can also create Flex applications using the free Flex SDK, which packages the Flex framework, along with a compiler and a debugger, in a free software development kit (see Figure 4).

The free Flex SDK provides the Flex framework and other tools.
Figure 4. The free Flex SDK provides the Flex framework and other tools.

If you use the Flex SDK, you would write your MXML and ActionScript code in any code or text editor and then use the command-line compiler to compile the application.

Flash Builder 4, formerly known as Flex Builder, is the Adobe commercial product geared towards developers building applications using the Flex framework. This tool includes everything in the Flex SDK plus many features to improve your productivity (see Figure 5).

Note: I mentioned earlier that Flash Catalyst is also based on the Flex framework; however, this article focuses on Flash Builder and ColdFusion development.

Flash Builder 4 includes everything in the Flex SDK and adds additional productivity tools.
Figure 5. Flash Builder 4 includes everything in the Flex SDK and adds additional productivity tools.

Flash Builder is based on the non-profit, open-source Eclipse development platform and application framework for building software. For developers who are already working with Eclipse, you can use the plug-in installer for Flash Builder. Developers who have never used Eclipse can use the standalone installer which is a customized package of Eclipse that includes the Flash Builder plug-in.

The new ColdFusion Builder tool is also based on the Eclipse software environment, which means that you can do both your Flex and ColdFusion development within the same Eclipse-based environment.

Understanding how Flex applications work with ColdFusion

In this last section, I will discuss two ways that Flex applications are often used with ColdFusion:

  • Application or widget embedded in a CFML page
  • Application or widget directly accessing CFCs to retrieve data or use other ColdFusion services

But first, let's quickly review how a typical CFML template is processed and displayed to an end user in a browser.

Reviewing CFML template processing

Figure 6 illustrates what happens when a CFML template is processed by the ColdFusion server.

ColdFusion server processes the CFML requests and generates HTML for display in the browser.
Figure 6. ColdFusion server processes the CFML requests and generates HTML for display in the browser.
  1. When the user requests the CFM page, the web server locates the file and passes it to the ColdFusion server for processing.
  2. The CFM page can be built procedurally with all of the code inline or it can be built to request functions from a CFC. The business logic in the code can access system resources like the database, mail server and file system.

    Note: You can read more about creating CFCs and using them with Flex applications in the article Understanding the role of CFCs in Flex application development.

  3. The CFM page uses the requested data and services to generate the HTML dynamic display and return it to the browser for rendering.

Next, let's take a look at how adding a compiled SWF file enhances this ColdFusion workflow.

Embedding Flex applications in CFML

Figure 7 illustrates how a compiled SWF file is embedded in the HTML code and referenced from the browser.

You embed the reference to the SWF file in your HTML code and it will be rendered in a browser that has Flash Player.
Figure 7. You embed the reference to the SWF file in your HTML code and it will be rendered in a browser that has Flash Player.

Steps 1-3 are exactly the same without a SWF file as with one. You can think of a SWF file as an asset like an image. The file is referenced from the HTML code, which prompts the browser to request it from the server. SWF files are rendered in the browser by the Flash Player.

The JavaScript code for embedding the SWF file in Figure 7 is an example from an HTML file that was automatically generated by Flash Builder when the application was compiled.

Requesting ColdFusion server data from Flex applications

The previous section showed you the implications of having a SWF file referenced from your ColdFusion template. What if you want the Flex application to actually retrieve new data and update its UI appropriately? You can do this by directly accessing CFCs from the SWF file as shown in Figure 8.

Figure 8. SWF files in the browser can directly request services from the ColdFusion server and send data to it via CFCs.
Figure 8. SWF files in the browser can directly request services from the ColdFusion server and send data to it via CFCs.

The ability for a Flex application to directly access data from the server is extremely powerful because it allows for dynamic content to update the Flex application user interface without refreshing the HTML page. It is also a great advantage to you because it decreases the number of requests to the server and the amount of content that is transferred over the network.

Where to go from here

Adobe Flex and Adobe ColdFusion are complementary technologies that can greatly enhance the usability and functionality of your applications. You can implement full-scale Flex applications with ColdFusion services for data or you can implement smaller widgets which live inline with your other HTML and JavaScript content.

  • To learn how to create CFCs for use with Flex, refer to the article Understanding the role of CFCs in Flex application development.
  • To learn more about the MXML and ActionScript programming languages, refer to the article Introducing the MXML and ActionScript Languages.
  • To get started building your first Flex application with Flash Builder and ColdFusion Builder, follow the steps outlined in the 3-part tutorial Set up and build your first Flex and ColdFusion application.

More Like This

  • Deploying a Flex application with ColdFusion URL variables
  • Creating ColdFusion Master/Detail forms with Adobe Flash Builder 4
  • Building a Flex application that connects to a BlazeDS Remoting destination using Flash Builder 4
  • Getting started with ColdFusion and Flash Builder 4 – Database, CFC, and data services setup
  • Understanding the role of CFCs in Flex application development
  • Generating ColdFusion forms with Adobe Flash Builder 4
  • Sending and receiving mobile text messages with Flex, ColdFusion, and BlazeDS
  • Project Hendrix: A call center Customer Experience Management solution
  • Building a Flex application that connects to a BlazeDS Remoting destination using Flash Builder 4.5
  • Working with Doctrine 2, Zend AMF, Flex, and Flash Builder

Tutorials & Samples

Tutorials

  • Flex mobile performance checklist
  • Flex and Maven with Flexmojos – Part 3: Journeyman
  • Migrating Flex 3 applications to Flex 4.5 – Part 4

Samples

  • Twitter Trends
  • Flex 4.5 reference applications
  • Mobile Trader Flex app on Android Market

Flex User Forum

More
07/25/2011 Flash Player Debug Issues - Safari 5.1 & Chrome 13
04/22/2012 Loader png - wrong color values in BitmapData
04/22/2012 HTTPService and crossdomain.xml doesn't work as expected
04/23/2012 Memory related crashes in Flex application

Flex Cookbook

More
04/06/2012 How to detect screen resize with a SkinnableComponent
02/29/2012 Embed Stage3D content inside Flex application components
02/15/2012 Custom WorkFlow Component
02/09/2012 Using Camera with a MediaContainer instead of VideoDisplay

Products

  • Acrobat
  • Creative Cloud
  • Creative Suite
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Elements
  • Mobile Apps
  • Photoshop
  • Touch Apps
  • Student and Teacher Editions

Solutions

  • Digital marketing
  • Digital media
  • Web Experience Management

Industries

  • Education
  • Financial services
  • Government

Help

  • Product help centers
  • Orders and returns
  • Downloading and installing
  • My Adobe

Learning

  • Adobe Developer Connection
  • Adobe TV
  • Training and certification
  • Forums
  • Design Center

Ways to buy

  • For personal and home office
  • For students, educators, and staff
  • For small and medium businesses
  • For businesses, schools, and government
  • Special offers

Downloads

  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2012 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy Policy and Cookies (Updated)

Ad Choices

Reviewed by TRUSTe: site privacy statement