You will be redirected in 30 seconds or close now.

ColdFusion Authors: Yakov Fain, Jeremy Geelan, Maureen O'Gara, Nancy Y. Nee, Tad Anderson

Related Topics: Adobe Flex, ColdFusion, Machine Learning

Adobe Flex: Article

Your First Adobe Flex Application with a ColdFusion Backend

The wow factor plus usability

Receiving Responses from the Server
If you recall, when you created the RemoteObject, each of the methods of the RemoteObject tag specified a function to be called when the response came back from the server:

<mx:method name="getAll" result="tasksReceived(event)" />
<mx:method name="save" result="taskSaved(event)" />

You already implemented the tasksReceived() function but left taskSaved() incomplete. This function will be called either because a new task was added or because a task was set as done. In each case, you should do something different. You could also implement two different methods in the service if you'd like to separate them.

If a new task was created, you want to add it to the main list of tasks, that is, to the "tasks" ArrayCollection that feeds the Repeater. If the task was updated (set as done), you want to remove it from the list.

private function taskSaved(event:ResultEvent):void {
    var taskItem:Task = event.result as Task;
    var i:Number = -1;
    if (taskItem.done){//we must remove it
      //find task in list
      for each (var thisTask:Task in tasks){
        if (thisTask.id == taskItem.id){
          //remove this item
      else {

Making Changes to the Generated ColdFusion Components
To make everything work, you'll have to make a couple of changes in the generated ColdFusion components. First you'll need to make the Task component generate a unique key before storing the data in the database:

<cfset var local0 = createUUID() />
<cfset setId(local0) />

That should be added to the "create" method.

Then your TaskGateway component should return the task it got in the "save" method:

<cffunction name="save" output="false" access="remote">
    <cfargument name="obj" required="true" />

    <cfset obj.save() />
    <cfreturn obj />

While you're at it, you may also want to change the getAll method so that it returns only the undone items, or you may want to delete the task when it's set as done.

Final Touches
As a final touch, you can add styling information to the application and to each individual control. An application-wide style file can be added by using the

As you can see, integrating Flex with ColdFusion is very simple and the CFC wizards greatly simplify the task. In addition, with the new Flex/ColdFusion connectivity features, you can send object instances from Flex to ColdFusion and from ColdFusion to Flex as if they were instantiated locally like you did with the Task.cfc-Task.as class mapping.

We hope this sample application gets you started using Flex and ColdFusion together to offer your users a nicer experience. We've only scratched the surface with this article; you can do much more with Flex. As your next steps, you can look at the sample code, read the tutorials at Adobe, and get your feet wet with an application of your own.

More Stories By Nahuel Foronda

Nahuel Foronda is one of the founders of Blue Instant (http://www.blueinstant.com), a web development firm specializing in Rich Internet Applications where he has been creating award-winning applications and offering training for the last five years. He also maintains a blog, called AS Fusion (http://www.asfusion.com), where he writes about Flash, ColdFusion and other web technologies.

More Stories By Laura Arguello

Laura Arguello is one of the founders of Blue Instant (http://www.blueinstant.com), a web development firm specializing in Rich Internet Applications where she has been creating award-winning applications and offering training for the last five years. She also maintains a blog, called AS Fusion (http://www.asfusion.com), where she writes about Flash, ColdFusion and other web technologies.

Comments (17)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

IoT & Smart Cities Stories
@CloudEXPO and @ExpoDX, two of the most influential technology events in the world, have hosted hundreds of sponsors and exhibitors since our launch 10 years ago. @CloudEXPO and @ExpoDX New York and Silicon Valley provide a full year of face-to-face marketing opportunities for your company. Each sponsorship and exhibit package comes with pre and post-show marketing programs. By sponsoring and exhibiting in New York and Silicon Valley, you reach a full complement of decision makers and buyers in ...
While the focus and objectives of IoT initiatives are many and diverse, they all share a few common attributes, and one of those is the network. Commonly, that network includes the Internet, over which there isn't any real control for performance and availability. Or is there? The current state of the art for Big Data analytics, as applied to network telemetry, offers new opportunities for improving and assuring operational integrity. In his session at @ThingsExpo, Jim Frey, Vice President of S...
The Internet of Things is clearly many things: data collection and analytics, wearables, Smart Grids and Smart Cities, the Industrial Internet, and more. Cool platforms like Arduino, Raspberry Pi, Intel's Galileo and Edison, and a diverse world of sensors are making the IoT a great toy box for developers in all these areas. In this Power Panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists discussed what things are the most important, which will have the most profound e...
Two weeks ago (November 3-5), I attended the Cloud Expo Silicon Valley as a speaker, where I presented on the security and privacy due diligence requirements for cloud solutions. Cloud security is a topical issue for every CIO, CISO, and technology buyer. Decision-makers are always looking for insights on how to mitigate the security risks of implementing and using cloud solutions. Based on the presentation topics covered at the conference, as well as the general discussions heard between sessio...
The Jevons Paradox suggests that when technological advances increase efficiency of a resource, it results in an overall increase in consumption. Writing on the increased use of coal as a result of technological improvements, 19th-century economist William Stanley Jevons found that these improvements led to the development of new ways to utilize coal. In his session at 19th Cloud Expo, Mark Thiele, Chief Strategy Officer for Apcera, compared the Jevons Paradox to modern-day enterprise IT, examin...
Rodrigo Coutinho is part of OutSystems' founders' team and currently the Head of Product Design. He provides a cross-functional role where he supports Product Management in defining the positioning and direction of the Agile Platform, while at the same time promoting model-based development and new techniques to deliver applications in the cloud.
In his keynote at 18th Cloud Expo, Andrew Keys, Co-Founder of ConsenSys Enterprise, provided an overview of the evolution of the Internet and the Database and the future of their combination – the Blockchain. Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settl...
There are many examples of disruption in consumer space – Uber disrupting the cab industry, Airbnb disrupting the hospitality industry and so on; but have you wondered who is disrupting support and operations? AISERA helps make businesses and customers successful by offering consumer-like user experience for support and operations. We have built the world’s first AI-driven IT / HR / Cloud / Customer Support and Operations solution.
LogRocket helps product teams develop better experiences for users by recording videos of user sessions with logs and network data. It identifies UX problems and reveals the root cause of every bug. LogRocket presents impactful errors on a website, and how to reproduce it. With LogRocket, users can replay problems.
Data Theorem is a leading provider of modern application security. Its core mission is to analyze and secure any modern application anytime, anywhere. The Data Theorem Analyzer Engine continuously scans APIs and mobile applications in search of security flaws and data privacy gaps. Data Theorem products help organizations build safer applications that maximize data security and brand protection. The company has detected more than 300 million application eavesdropping incidents and currently secu...