Welcome!

Adobe Flex Authors: Matthew Lobas, PR.com Newswire, Shelly Palmer, Kevin Benedict

Related Topics: Adobe Flex, ColdFusion, AJAX & REA

Adobe Flex: Article

Your First Adobe Flex Application with a ColdFusion Backend

The wow factor plus usability

Flex is a complete set of tools to develop rich Internet cross-platform applications based on the Flash platform. With Flex, you can create applications that not only have the "wow factor" necessary to please clients and users alike, but the "usability factor" necessary to make your application a real success.

 Flex 2 has recently been released and can be downloaded at Adobe's Web site. This release includes Flex Builder 2 (an IDE based on Eclipse) and Flash Player 9. At Adobe's Web site, you'll also find tools specifically for ColdFusion such as the ColdFusion/Flex Connectivity package and ColdFusion extensions for Flex Builder. If you know how Flex 1.5 works, you'll be happy to hear that Flex 2 doesn't require a Flex server and that you can develop and deploy applications with Flex 2 for free using the Flex SDK (if you don't use the IDE).

A Flex application communicates to external services, and we find ColdFusion to be a perfect tool for providing those services. In this article, we'll walk you through the construction of an application with a Flex frontend and a ColdFusion backend. We believe that the integration with ColdFusion is so smooth you won't even notice you're transferring data from a remote server. The application you'll construct is a simple to-do list, but it will let us show you several Flex and ColdFusion features.

To start, you'll need the tools mentioned above, specifically Flex Builder IDE and the ColdFusion connectivity package and extensions downloaded and installed.

Setting Up Your Environment
The application will use a database with only one table, so you need to create a database with your favorite DBMS. This database should contain a table called "Task" with the following columns: id (varchar 35), description (varchar 1000), done (bit), and priority (smallint). Then register the data source in the CF administrator with the name "mytodolist."

Now you're ready to open Flex Builder and create a new project. While running the New Project wizard, specify that you'll be using ColdFusion Flash Remoting Services because the application will be communicating to your ColdFusion server via Flash Remoting rather than other alternatives such as XML or Web Services (see Figure 1). Assuming that you're running the development version on your local computer (http://localhost:8500), you can select "Use local ColdFusion server" in the second screen of the wizard. In the next screen enter "mytodolist" as the name of the project in the default location and finally, in the last screen, specify "http://localhost:8500/mytodolist/" as the Output folder URL.

The extensions you downloaded and installed include RDS support for viewing files and data sources. Make sure you have RDS enabled in your CF administrator and that you've set up the RDS preferences in Flex Builder. If your RDS connection is set up properly, you should be able to open the RDS Dataview (you can open it from Window > Other Views > RDS) and see the data source you created earlier (see Figure 2).

Running the ColdFusion Wizard
Another handy feature included in the ColdFusion extensions is the ability to run automatic generation of basic ColdFusion components. The "Create CFC" wizard will generate all the ColdFusion code you need for this application. Then you'll make a few changes to the components to meet specific needs. From the RDS Dataview, look for your data source ("mytodolist"), open the tables node, and right-click on the "Task" table to run the ColdFusion wizards > Create CFC option of the context menu (see Figure 3). This action will open a dialog that asks you what type of CFC you want and some other basic options. Make sure the CFC folder is your current project folder (mytodolist). Set the CFC package name to "mytodolist." Also check the option "The primary key is controlled by the user" because the component will set the id instead of letting the database choose the id. You also want to create an ActionScript value object that matches your Task CFC. So you need to check "Create an actionscript value object."

When you're finished, you should have three new files in your project: Task.cfc, TaskGateway.cfc, and Task.as.

Overview of the Application
The application consists of a list of undone tasks and a form to add a new task. Each task contains an icon that indicates its priority, a label that shows the description of the task, and a button that can mark the task done and remove it from the view. Figure 4 shows the finished application with styles applied.

To construct it, you'll use these components: VBox, Repeater, Panel, Button, Label, and form controls such as TextArea and ComboBox. You'll also create a custom component that will represent the view of each task item (TaskItem.mxml) and a custom component that will contain the edit form (EditForm.mxml). By creating custom components, you can reuse them throughout your application.

If you are wondering about the data, the application will get the list of tasks from a ColdFusion service and send requests to add new tasks and mark them as done.

Main Application File
The New Project wizard created an empty main application file called mytodolist.mxml. You'll use this file as the main canvas where you'll place the components and most of the ActionScript code. In a larger application, you will probably not want all your code in the same file, but for simplicity, you'll keep it there.

We have not yet described how to get the data from the server, but once the application gets the list of tasks, you'll need to store it in a local variable. To do that, declare the variable "tasks" inside a <mx:Script> block.

<mx:Script>
   <![CDATA[
      import mx.collections.ArrayCollection;

      [Bindable]
      private var tasks:ArrayCollection = null;
   ]]>
</mx:Script>

It's important to set this variable as "bindable" because you'll use it as the dataProvider of the repeater component.

In our layout, we want to have the list of tasks vertically positioned with one task below the other. By using a VBox component, we can add all the tasks and the VBox will position them how we want them. But the task list data will come from a ColdFusion service, so you don't know how many of them there'll be. So you'll use a repeater component that will "loop" over the collection of tasks and add them to the VBox.

<mx:VBox width="350">
<mx:Repeater dataProvider="{tasks}" id="taskList">
      <TaskItem taskData="{taskList.currentItem}" />
   </mx:Repeater>
</mx:VBox>

TaskItem Custom Component
If you save mytodolist.mxml file, you'll get an error indicating the TaskItem can't be resolved. This happens because we put the tag <TaskItem> inside the Repeater but the component TaskItem doesn't exist yet.

To create this custom component, you'll go to the File menu and click on New > MXML component. It will extend the Canvas and have 100% width because we want it to take the width of the parent container: the VBox. Save it as TaskItem.mxml.

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) View Comments

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.


Most Recent Comments
??? 10/30/07 01:47:34 AM EDT

Ipod MP4

????
????
????
????
??
????
????
????
???
????
???? 

donna 10/12/07 01:28:46 PM EDT

Unable to download the source code. When I got to page http://www.asfusion.com/projects/my-to-do-list/

I received a Coldfusion error:

A License exception has occurred.
You tried to access the Developer Edition from a disallowed IPThe Developer Edition can only be accessed from 127.0.0.1 and two additional IP addresses. The additional IP addresses are: 209.85.238.20,87.194.221.84

There are so many issues encountered with the tutorial apps out there, that dont work when people follow the isntructions exactly. We need apps that work when followed, and we need downloaded source code that will actually be there.

Lara 07/30/07 11:59:27 AM EDT

I am familiar with ColdFusion but completly new to Flex. I can't get the code to work and I am very frustrated. This isn't a good first application example if we can't work the code. Does anyone have the working source files? If so, please post a link to the corrected files. Thanks!

Jason 06/26/07 02:20:44 PM EDT

I love all the article put out by sys-con and found that they are top quality, that is until this one. I have been struggling with learning Flex and found this article and initally was excited because it looked like the article that was going to clear things up. Until I started in and realized that this article is full of mistakes. Flex is VERY case sensitive where as ColdFusion is not. Since this article is target at ColdFusion developers you need to make sure that the code is correct expecially in the area of case sensitivity because we ususally don't think in that manner (it is "faultString" not "faultstring"). Also you need to make sure that you are using the same name for functions. You have us call the addItem() function through a click event but then on the next page we create the saveItem() function to handle that click event. This won't work! Then we need to make changes to the generated CFCs. You show us the two lines of code that we need to add and simply state that they "should be added to the 'create' method." Ok, but where in the create method. I moved them all over and I continually get errors. I have yet to find a competent article for the Flex "newbie" that achieves its goal of showing how to do basic updates and adds with Flex and CF. I thought that this was going to be the one. Guess I was wrong!

KTK 06/07/07 03:53:09 PM EDT

I'm glad it's not just me! I've had to put this aside for a couple weeks to work on a CF project. Hopefully I can get back to it later this month. If you figure something out, let me know and if I figure it out, I'll let you know. In the meantime, maybe a savior will come along for both of us!

Scott 06/07/07 01:30:06 PM EDT

KTK - I have the same problem and I followed all of the instructions exactly.

Uf!

KTK 06/04/07 01:28:59 PM EDT

I'm getting an error that says "A file found in a source-path must have the same package structure '', as the definition's package, 'Task'. I've been beating my head against it for hours and can't figure out why I'm getting the error. Any ideas?

jex 11/04/06 11:26:10 AM EST

OK - I'm a bit new to both Flex and CF, but have been implementing the tutorial fine up until: "Going back to the main application file (mytodolist.mxml), switch to the design view and drag a new panel and inside drag your EditForm component." When I drag the EditForm component onto the panel, nothing happens. Would it be possible to explain exactly what has to be done here? Many thanks.

jex 11/04/06 11:24:25 AM EST

Problem solved - I was trying to drag the EditForm.mxml - but it's the EditForm component(as it says in the tutorial)which needs to be dragged - this is found in the custom component folder.

jex 11/04/06 10:19:33 AM EST

OK - I'm a bit new to both Flex and CF, but have been implementing the tutorial fine up until: "Going back to the main application file (mytodolist.mxml), switch to the design view and drag a new panel and inside drag your EditForm component." When I drag the EditForm component onto the panel, nothing happens. Would it be possible to explain exactly what has to be done here? Many thanks.

Francois-Yanick Bourassa 08/09/06 04:21:30 PM EDT

I found myself a bit confused to follow this article as it is a bit out of the real target - which is bringing new people to use Flex and ColdFusion. As a ColdFusion programmer, I found very interesting to try this example with Flex. But after couple paragraphs, started to be confused on which file I was suppose to put the code as Flex is a real new thing for me - I'm sure it will be the same for few of us - if it is not more! We use to read article where editor just put rectangle on source code by page - but this article seems to have a different goal!

I will figure out what was wrong in the code because I think I can but what about newbies!!!

This was my personal feedback!

AJAXWorld News Desk 08/09/06 08:35:47 AM EDT

Flex is a complete set of tools to develop rich Internet cross-platform applications based on the Flash platform. With Flex, you can create applications that not only have the 'wow factor' necessary to please clients and users alike, but the 'usability factor' necessary to make your application a real success.

cfdj news desk 08/08/06 08:29:03 PM EDT

Flex is a complete set of tools to develop rich Internet cross-platform applications based on the Flash platform. With Flex, you can create applications that not only have the 'wow factor' necessary to please clients and users alike, but the 'usability factor' necessary to make your application a real success.

CFDJ News Desk 08/08/06 07:25:22 PM EDT

Flex is a complete set of tools to develop rich Internet cross-platform applications based on the Flash platform. With Flex, you can create applications that not only have the 'wow factor' necessary to please clients and users alike, but the 'usability factor' necessary to make your application a real success.

AJAXWorld News Desk 08/08/06 07:11:51 PM EDT

Flex is a complete set of tools to develop rich Internet cross-platform applications based on the Flash platform. With Flex, you can create applications that not only have the 'wow factor' necessary to please clients and users alike, but the 'usability factor' necessary to make your application a real success.

AJAXWorld News Desk 08/07/06 03:11:03 PM EDT

Flex is a complete set of tools to develop rich Internet cross-platform applications based on the Flash platform. With Flex, you can create applications that not only have the 'wow factor' necessary to please clients and users alike, but the 'usability factor' necessary to make your application a real success.

SYS-CON Australia News Desk 08/07/06 09:34:46 AM EDT

Flex is a complete set of tools to develop rich Internet cross-platform applications based on the Flash platform. With Flex, you can create applications that not only have the 'wow factor' necessary to please clients and users alike, but the 'usability factor' necessary to make your application a real success.

@ThingsExpo Stories
We are reaching the end of the beginning with WebRTC, and real systems using this technology have begun to appear. One challenge that faces every WebRTC deployment (in some form or another) is identity management. For example, if you have an existing service – possibly built on a variety of different PaaS/SaaS offerings – and you want to add real-time communications you are faced with a challenge relating to user management, authentication, authorization, and validation. Service providers will want to use their existing identities, but these will have credentials already that are (hopefully) i...
The Internet of Things will greatly expand the opportunities for data collection and new business models driven off of that data. In her session at @ThingsExpo, Esmeralda Swartz, CMO of MetraTech, discussed how for this to be effective you not only need to have infrastructure and operational models capable of utilizing this new phenomenon, but increasingly service providers will need to convince a skeptical public to participate. Get ready to show them the money!
One of the biggest challenges when developing connected devices is identifying user value and delivering it through successful user experiences. In his session at Internet of @ThingsExpo, Mike Kuniavsky, Principal Scientist, Innovation Services at PARC, described an IoT-specific approach to user experience design that combines approaches from interaction design, industrial design and service design to create experiences that go beyond simple connected gadgets to create lasting, multi-device experiences grounded in people's real needs and desires.
Scott Jenson leads a project called The Physical Web within the Chrome team at Google. Project members are working to take the scalability and openness of the web and use it to talk to the exponentially exploding range of smart devices. Nearly every company today working on the IoT comes up with the same basic solution: use my server and you'll be fine. But if we really believe there will be trillions of these devices, that just can't scale. We need a system that is open a scalable and by using the URL as a basic building block, we open this up and get the same resilience that the web enjoys.
The Internet of Things is tied together with a thin strand that is known as time. Coincidentally, at the core of nearly all data analytics is a timestamp. When working with time series data there are a few core principles that everyone should consider, especially across datasets where time is the common boundary. In his session at Internet of @ThingsExpo, Jim Scott, Director of Enterprise Strategy & Architecture at MapR Technologies, discussed single-value, geo-spatial, and log time series data. By focusing on enterprise applications and the data center, he will use OpenTSDB as an example t...
P2P RTC will impact the landscape of communications, shifting from traditional telephony style communications models to OTT (Over-The-Top) cloud assisted & PaaS (Platform as a Service) communication services. The P2P shift will impact many areas of our lives, from mobile communication, human interactive web services, RTC and telephony infrastructure, user federation, security and privacy implications, business costs, and scalability. In his session at @ThingsExpo, Robin Raymond, Chief Architect at Hookflash, will walk through the shifting landscape of traditional telephone and voice services ...
The Domain Name Service (DNS) is one of the most important components in networking infrastructure, enabling users and services to access applications by translating URLs (names) into IP addresses (numbers). Because every icon and URL and all embedded content on a website requires a DNS lookup loading complex sites necessitates hundreds of DNS queries. In addition, as more internet-enabled ‘Things' get connected, people will rely on DNS to name and find their fridges, toasters and toilets. According to a recent IDG Research Services Survey this rate of traffic will only grow. What's driving t...
Enthusiasm for the Internet of Things has reached an all-time high. In 2013 alone, venture capitalists spent more than $1 billion dollars investing in the IoT space. With "smart" appliances and devices, IoT covers wearable smart devices, cloud services to hardware companies. Nest, a Google company, detects temperatures inside homes and automatically adjusts it by tracking its user's habit. These technologies are quickly developing and with it come challenges such as bridging infrastructure gaps, abiding by privacy concerns and making the concept a reality. These challenges can't be addressed w...
Explosive growth in connected devices. Enormous amounts of data for collection and analysis. Critical use of data for split-second decision making and actionable information. All three are factors in making the Internet of Things a reality. Yet, any one factor would have an IT organization pondering its infrastructure strategy. How should your organization enhance its IT framework to enable an Internet of Things implementation? In his session at Internet of @ThingsExpo, James Kirkland, Chief Architect for the Internet of Things and Intelligent Systems at Red Hat, described how to revolutioniz...
Bit6 today issued a challenge to the technology community implementing Web Real Time Communication (WebRTC). To leap beyond WebRTC’s significant limitations and fully leverage its underlying value to accelerate innovation, application developers need to consider the entire communications ecosystem.
The definition of IoT is not new, in fact it’s been around for over a decade. What has changed is the public's awareness that the technology we use on a daily basis has caught up on the vision of an always on, always connected world. If you look into the details of what comprises the IoT, you’ll see that it includes everything from cloud computing, Big Data analytics, “Things,” Web communication, applications, network, storage, etc. It is essentially including everything connected online from hardware to software, or as we like to say, it’s an Internet of many different things. The difference ...
Cloud Expo 2014 TV commercials will feature @ThingsExpo, which was launched in June, 2014 at New York City's Javits Center as the largest 'Internet of Things' event in the world.
SYS-CON Events announced today that Windstream, a leading provider of advanced network and cloud communications, has been named “Silver Sponsor” of SYS-CON's 16th International Cloud Expo®, which will take place on June 9–11, 2015, at the Javits Center in New York, NY. Windstream (Nasdaq: WIN), a FORTUNE 500 and S&P 500 company, is a leading provider of advanced network communications, including cloud computing and managed services, to businesses nationwide. The company also offers broadband, phone and digital TV services to consumers primarily in rural areas.
"There is a natural synchronization between the business models, the IoT is there to support ,” explained Brendan O'Brien, Co-founder and Chief Architect of Aria Systems, in this SYS-CON.tv interview at the 15th International Cloud Expo®, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
The major cloud platforms defy a simple, side-by-side analysis. Each of the major IaaS public-cloud platforms offers their own unique strengths and functionality. Options for on-site private cloud are diverse as well, and must be designed and deployed while taking existing legacy architecture and infrastructure into account. Then the reality is that most enterprises are embarking on a hybrid cloud strategy and programs. In this Power Panel at 15th Cloud Expo (http://www.CloudComputingExpo.com), moderated by Ashar Baig, Research Director, Cloud, at Gigaom Research, Nate Gordon, Director of T...
An entirely new security model is needed for the Internet of Things, or is it? Can we save some old and tested controls for this new and different environment? In his session at @ThingsExpo, New York's at the Javits Center, Davi Ottenheimer, EMC Senior Director of Trust, reviewed hands-on lessons with IoT devices and reveal a new risk balance you might not expect. Davi Ottenheimer, EMC Senior Director of Trust, has more than nineteen years' experience managing global security operations and assessments, including a decade of leading incident response and digital forensics. He is co-author of t...

ARMONK, N.Y., Nov. 20, 2014 /PRNewswire/ --  IBM (NYSE: IBM) today announced that it is bringing a greater level of control, security and flexibility to cloud-based application development and delivery with a single-tenant version of Bluemix, IBM's platform-as-a-service. The new platform enables developers to build ap...

The security devil is always in the details of the attack: the ones you've endured, the ones you prepare yourself to fend off, and the ones that, you fear, will catch you completely unaware and defenseless. The Internet of Things (IoT) is nothing if not an endless proliferation of details. It's the vision of a world in which continuous Internet connectivity and addressability is embedded into a growing range of human artifacts, into the natural world, and even into our smartphones, appliances, and physical persons. In the IoT vision, every new "thing" - sensor, actuator, data source, data con...
Technology is enabling a new approach to collecting and using data. This approach, commonly referred to as the "Internet of Things" (IoT), enables businesses to use real-time data from all sorts of things including machines, devices and sensors to make better decisions, improve customer service, and lower the risk in the creation of new revenue opportunities. In his General Session at Internet of @ThingsExpo, Dave Wagstaff, Vice President and Chief Architect at BSQUARE Corporation, discuss the real benefits to focus on, how to understand the requirements of a successful solution, the flow of ...
"BSQUARE is in the business of selling software solutions for smart connected devices. It's obvious that IoT has moved from being a technology to being a fundamental part of business, and in the last 18 months people have said let's figure out how to do it and let's put some focus on it, " explained Dave Wagstaff, VP & Chief Architect, at BSQUARE Corporation, in this SYS-CON.tv interview at @ThingsExpo, held Nov 4-6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.