Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Expo on Google News


2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
SYS-CON.TV
Top Links You Must Click On


Let Macromedia Flex Consume Your CFCs
A more programmatic approach to building RIAs

In previous articles I've written about the power of integrating Flash and ColdFusion to build Rich Internet Applications (RIAs). In this paradigm Flash provides the user interface while ColdFusion is responsible for handling the business logic and sending data to Flash either through Flash Remoting or Web Service calls. In this article I'd like to shift focus a bit and provide a more programmatic approach to building RIAs. By this I mean using XML to create the Flash interface. The answer lies in Macromedia's Flex.

This article will walk you through a simple application that retrieves employee records from a database so the user can update them. This is by no means a new concept, but I'd like to try a different approach. Forget about HTML, or even Flash forms for that matter, and see what Flex has to offer. If you've done any ColdFusion component development then I want to challenge you to experiment with Flex as your presentation tier. We'll dig into this concept in greater detail but let's first configure the application.

Walking Through the Example Application
You can download the source code for the example application at www.db75.com/dev/mxdj/mxdj_0605.zip. Please refer to the Readme.txt file included in the zip archive. This file has all the information necessary to get the example application up and running.

Once you've deployed the files to their proper locations and updated flex-config.xml, you should be able to access EmployeeForm.mxml through its fully qualified name, i.e., http://localhost:8080/flex/EmployeeForm.mxml. Once Flex compiles this file you should see something similar to Figure 1.

Let's open EmployeeForm.mxml so we can walk through the code and get a general understanding of what's going on. You can review the mxml code in the following code.

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
creationComplete="getEmployeeList();">

<mx:Script>
<![CDATA[

var selectedEmployeeID:Number;
var selectedIndex:Number;

// Gets the list of employees and is bound to the combo box
function getEmployeeList():Void
{
employeeWS.getEmployeeList.send();
}

// Get the employee when the selection is made in the datagrid
function getEmployee(event):Void
{
selectedEmployeeID = event.target.selectedItem.EMP_ID;
selectedIndex = event.target.selectedIndex;
employeeWS.getEmployee(selectedEmployeeID).send();
}

// Update the employee info
function updateEmployee():Void
{
var employeeObj:Object = new Object();
employeeObj.first_name = first_name.text;
employeeObj.last_name = last_name.text;
employeeObj.email = email.text;
employeeObj.id = selectedEmployeeID;
employeeWS.updateEmployee(employeeObj).send();
employeeDG.replaceItemAt(selectedIndex,
{FIRSTNAME:employeeObj.first_name,
LASTNAME: employeeObj.last_name});
}
]]>
</mx:Script>

<mx:WebService
serviceName="EmployeeService"
id="employeeWS"
showBusyCursor="true"
fault="mx.controls.Alert.show('Error Loading Data');" />

<mx:Panel title="Employee Form">

<mx:DataGrid dataProvider="{employeeWS.getEmployeeList.result}" id="employeeDG"
width="100%" change="getEmployee(event);">
<mx:columns>
<mx:Array>
<mx:DataGridColumn columnName="EMP_ID" width="0" />
<mx:DataGridColumn columnName="FIRSTNAME" headerText="First Name" />
<mx:DataGridColumn columnName="LASTNAME" headerText="Last Name" />
</mx:Array>
</mx:columns>
</mx:DataGrid>

<mx:Form>

<mx:FormItem label="First Name">
<mx:TextInput id="first_name" width="200"
text="{employeeWS.getEmployee.result[0].FIRSTNAME}" />
</mx:FormItem>

<mx:FormItem label="Last Name">
<mx:TextInput id="last_name" width="200"
text="{employeeWS.getEmployee.result[0].LASTNAME}" />
</mx:FormItem>

<mx:FormItem label="Email">
<mx:TextInput id="email" width="200"
text="{employeeWS.getEmployee.result[0].EMAIL}" />
</mx:FormItem>

<mx:FormItem>
<mx:Button label="Update" click="updateEmployee();"/>
</mx:FormItem>

</mx:Form>

<mx:ControlBar />
</mx:Panel>
</mx:Application>

About Dennis Baldwin
Dennis Baldwin is a software developer for SensorLogic Inc, an M2M application service provider. He also runs and maintains an online community for Flash and ColdFusion developers at www.devmx.com.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Let Macromedia Flex Consume Your CFCs. In previous articles I've written about the power of integrating Flash and ColdFusion to build Rich Internet Applications (RIAs). In this paradigm Flash provides the user interface while ColdFusion is responsible for handling the business logic and sending data to Flash either through Flash Remoting or Web Service calls. In this article I'd like to shift focus a bit and provide a more programmatic approach to building RIAs. By this I mean using XML to create the Flash interface. The answer lies in Macromedia's Flex.


Your Feedback
JDJ News Desk wrote: Let Macromedia Flex Consume Your CFCs. In previous articles I've written about the power of integrating Flash and ColdFusion to build Rich Internet Applications (RIAs). In this paradigm Flash provides the user interface while ColdFusion is responsible for handling the business logic and sending data to Flash either through Flash Remoting or Web Service calls. In this article I'd like to shift focus a bit and provide a more programmatic approach to building RIAs. By this I mean using XML to create the Flash interface. The answer lies in Macromedia's Flex.
Enterprise Open Source Magazine Latest Stories . . .
Apache Deltacloud, the Red Hat-contributed ReSTful API that abstracts differences between clouds so services on any cloud can be managed – provided of course there’s a driver – has graduated from the Apache Foundation’s incubator and is now a full-fledged Top-Level Project (TLP). The...
With Cloud Expo 2012 New York (10th Cloud Expo) just four months away, what better time to start introducing you in greater detail to the distinguished individuals in our incredible Speaker Faculty for the technical and strategy sessions at the conference... We have technical and st...
AMD said late Tuesday that its chief sales officer Emilio Ghilardi had left the company and that CEO and president Rory Read is going to do his job while a replacement is sought. AMD didn’t say why Ghilardi left but it’s assumed Read wants his own people. Read is relatively new to th...
During the lifespan of M3 (Monitis Monitor Manager) there has always been something lacking – timers. M3 execution procedure was outlined in this previous article. The execution mentioned in the latter was a one-time-execution, whereas server monitoring requires periodic invocati...
Red Hat is putting its bought-in Gluster scale-out NAS storage technology, acquired in October, on the Amazon cloud. It’s styled Red Hat Virtual Storage Appliance for Amazon Web Services and other clouds are supposed to follow in short order.
A new episode of the screencast series is now available at the OpenNebula YouTube Channel. This screencast demonstrates the new easily-customizable self-service portal for cloud consumers. Its aim is to offer a simplified access to shared infrastructure for non-IT end users. The scree...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON Featured Whitepapers
ADS BY GOOGLE