Click here to close now.

Welcome!

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

Related Topics: Adobe Flex, ColdFusion, IoT User Interface

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
The 5th International DevOps Summit, co-located with 17th International Cloud Expo – being held November 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA – announces that its Call for Papers is open. Born out of proven success in agile development, cloud computing, and process automation, DevOps is a macro trend you cannot afford to miss. From showcase success stories from early adopters and web-scale businesses, DevOps is expanding to organizations of all sizes, including the world's largest enterprises – and delivering real results. Among the proven benefits, DevOps is corr...
The 17th International Cloud Expo has announced that its Call for Papers is open. 17th International Cloud Expo, to be held November 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA, brings together Cloud Computing, APM, APIs, Microservices, Security, Big Data, Internet of Things, DevOps and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportunity. Submit your speaking proposal today!
The basic integration architecture, as defined by ESBs, hasn’t changed for more than a decade. Most cloud integration providers still rely on an ESB architecture and their proprietary connectors. As a result, enterprise integration projects suffer from constraints of availability and reliability of these connectors that are not re-usable across other integration vendors. However, the rapid adoption of APIs and almost ubiquitous availability of APIs amongst most SaaS and Cloud applications are rapidly redefining traditional integration approaches and their reliance on proprietary connectors. ...
SYS-CON Events announced today that Secure Infrastructure & Services will exhibit at SYS-CON's 17th International Cloud Expo®, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. Secure Infrastructure & Services (SIAS) is a managed services provider of cloud computing solutions for the IBM Power Systems market. The company helps mid-market firms built on IBM hardware platforms to deploy new levels of reliable and cost-effective computing and high availability solutions, leveraging the cloud and the benefits of Infrastructure-as-a-Service (IaaS...
17th Cloud Expo, taking place Nov 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy. Meanwhile, 94% of enterprises are using some form of XaaS – software, platform, and infrastructure as a service.
It is one thing to build single industrial IoT applications, but what will it take to build the Smart Cities and truly society-changing applications of the future? The technology won’t be the problem, it will be the number of parties that need to work together and be aligned in their motivation to succeed. In his session at @ThingsExpo, Jason Mondanaro, Director, Product Management at Metanga, discussed how you can plan to cooperate, partner, and form lasting all-star teams to change the world and it starts with business models and monetization strategies.
Today air travel is a minefield of delays, hassles and customer disappointment. Airlines struggle to revitalize the experience. GE and M2Mi will demonstrate practical examples of how IoT solutions are helping airlines bring back personalization, reduce trip time and improve reliability. In their session at @ThingsExpo, Shyam Varan Nath, Principal Architect with GE, and Dr. Sarah Cooper, M2Mi’s VP Business Development and Engineering, will explore the IoT cloud-based platform technologies driving this change including privacy controls, data transparency and integration of real time context wi...
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 @ThingsExpo, James Kirkland, Red Hat's Chief Architect for the Internet of Things and Intelligent Systems, described how to revolutionize your archit...
WebRTC converts the entire network into a ubiquitous communications cloud thereby connecting anytime, anywhere through any point. In his session at WebRTC Summit,, Mark Castleman, EIR at Bell Labs and Head of Future X Labs, will discuss how the transformational nature of communications is achieved through the democratizing force of WebRTC. WebRTC is doing for voice what HTML did for web content.
The Internet of Things is not only adding billions of sensors and billions of terabytes to the Internet. It is also forcing a fundamental change in the way we envision Information Technology. For the first time, more data is being created by devices at the edge of the Internet rather than from centralized systems. What does this mean for today's IT professional? In this Power Panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists addressed this very serious issue of profound change in the industry.
Internet of Things (IoT) will be a hybrid ecosystem of diverse devices and sensors collaborating with operational and enterprise systems to create the next big application. In their session at @ThingsExpo, Bramh Gupta, founder and CEO of robomq.io, and Fred Yatzeck, principal architect leading product development at robomq.io, discussed how choosing the right middleware and integration strategy from the get-go will enable IoT solution developers to adapt and grow with the industry, while at the same time reduce Time to Market (TTM) by using plug and play capabilities offered by a robust IoT ...
"We have a tagline - "Power in the API Economy." What that means is everything that is built in applications and connected applications is done through APIs," explained Roberto Medrano, Executive Vice President at Akana, in this SYS-CON.tv interview at 16th Cloud Expo, held June 9-11, 2015, at the Javits Center in New York City.
Internet of Things is moving from being a hype to a reality. Experts estimate that internet connected cars will grow to 152 million, while over 100 million internet connected wireless light bulbs and lamps will be operational by 2020. These and many other intriguing statistics highlight the importance of Internet powered devices and how market penetration is going to multiply many times over in the next few years.
To many people, IoT is a buzzword whose value is not understood. Many people think IoT is all about wearables and home automation. In his session at @ThingsExpo, Mike Kavis, Vice President & Principal Cloud Architect at Cloud Technology Partners, discussed some incredible game-changing use cases and how they are transforming industries like agriculture, manufacturing, health care, and smart cities. He will discuss cool technologies like smart dust, robotics, smart labels, and much more. Prepare to be blown away with a glimpse of the future.
SYS-CON Events announced today that BMC will exhibit at SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. BMC delivers software solutions that help IT transform digital enterprises for the ultimate competitive business advantage. BMC has worked with thousands of leading companies to create and deliver powerful IT management services. From mainframe to cloud to mobile, BMC pairs high-speed digital innovation with robust IT industrialization – allowing customers to provide amazing user experiences with optimized IT per...
There will be 150 billion connected devices by 2020. New digital businesses have already disrupted value chains across every industry. APIs are at the center of the digital business. You need to understand what assets you have that can be exposed digitally, what their digital value chain is, and how to create an effective business model around that value chain to compete in this economy. No enterprise can be complacent and not engage in the digital economy. Learn how to be the disruptor and not the disruptee.
The Internet of Things is not only adding billions of sensors and billions of terabytes to the Internet. It is also forcing a fundamental change in the way we envision Information Technology. For the first time, more data is being created by devices at the edge of the Internet rather than from centralized systems. What does this mean for today's IT professional? In this Power Panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists will addresses this very serious issue of profound change in the industry.
Business as usual for IT is evolving into a "Make or Buy" decision on a service-by-service conversation with input from the LOBs. How does your organization move forward with cloud? In his general session at 16th Cloud Expo, Paul Maravei, Regional Sales Manager, Hybrid Cloud and Managed Services at Cisco, discusses how Cisco and its partners offer a market-leading portfolio and ecosystem of cloud infrastructure and application services that allow you to uniquely and securely combine cloud business applications and services across multiple cloud delivery models.
In his General Session at 16th Cloud Expo, David Shacochis, host of The Hybrid IT Files podcast and Vice President at CenturyLink, investigated three key trends of the “gigabit economy" though the story of a Fortune 500 communications company in transformation. Narrating how multi-modal hybrid IT, service automation, and agile delivery all intersect, he will cover the role of storytelling and empathy in achieving strategic alignment between the enterprise and its information technology.
Buzzword alert: Microservices and IoT at a DevOps conference? What could possibly go wrong? In this Power Panel at DevOps Summit, moderated by Jason Bloomberg, the leading expert on architecting agility for the enterprise and president of Intellyx, panelists peeled away the buzz and discuss the important architectural principles behind implementing IoT solutions for the enterprise. As remote IoT devices and sensors become increasingly intelligent, they become part of our distributed cloud environment, and we must architect and code accordingly. At the very least, you'll have no problem fillin...