Welcome!

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

Related Topics: Adobe Flex, ColdFusion, SYS-CON MEDIA

Adobe Flex: Article

Getting Started with Adobe Flex 2

Flex, as I'm sure most people know, is a way for programmers to create Flash movies

I'm going to postpone the second part of my RSS aggregator article to tie this column into this Flex-themed issue. Have no fears, though, it will be back in full force in the next issue. Flex, as I'm sure most people know, is a way for programmers (you, me, and us) to create Flash movies.

 The focus of Flex is not on animation and drawing little fancy pictures; it's on creating advanced interfaces, which are used to create Rich Internet Applications (RIA). It is a "Flash for programmers"-oriented product. Macromedia had long been pushing the concept and benefits of Rich Internet Applications, so it's great to see Adobe taking up the charge and finally making them accessible to all.

Flex 2 was released at Adobe's CFUNITED keynote (a few days ago to me), so this issue seems appropriately timed. I thought I'd take the space in this beginner's column for an overview of Flex 2 and talk about why you want to care.

Putting the Pieces Together
Everyone who has seen Flex from the beginning viewed it as an amazing and revolutionary product. If you think of ColdFusion as a way to build HTML pages on the fly, Flex was a way to build Flash movies on the fly. Unfortunately, most people found the price tag to be a serious setback to Flex usage. Adobe has addressed those concerns head on with the release of Flex 2.

These are the components that make up the Flex 2 suite of products:

  • ActionScript 3: The language of Flash has always been ActionScript. With the release of the Flash 9 Player comes a new version of ActionScript. ActionScript has always been used to provide advanced functionality in a Flash movie.
  • MXML: MXML stands for Maximum Experience Markup Language and is a form of XML. You can use MXML to create Flash movies with Flex. Most things in ActionScript have a parallel in MXML, and vice versa.
  • Flash 9 Player: Flex applications will run only on Flash Player 9. Flash Player 9 adds support for ActionScript 3, and offers many performance enhancements over Flash 8.
  • Flex SDK: The Flex SDK is everything you need to build Flex applications. It contains a command-line compiler along with all the built-in Flex components (which includes a bunch of user interface elements). You can write MXML code in any editor of your choice, use the SDK to compile it to a swf file, and then deploy it to a Web server of your choosing. There have been rumors that Adobe hopes the release of the SDK will allow for the creation of third-party tools for generating Flex applications. I haven't heard of any tools being built yet, but this definitely bodes well for the long-term release of the community. Did I mention that the Flex SDK is free?
  • Flex Builder 2: Flex Builder 2 is an Eclipse-based editor for building Flex applications. Although you can use the Flex SDK to build them for free, Flex Builder offers many advantages, including tag insight and a step-through debugger. Flex Builder is available as a standalone product or as an Eclipse plug-in. I like to use the plug-in version so that my Flex applications can easily reside next to CFEclipse applications.
  • Flex Charting Components: The Flex charting components are available as a standalone package or as an add-on to Flex Builder. They make it easy for you to generate charts in Flex, as well as allow for drill down and roll over functionality.
  • Flex Data Services: Flex data services allow you to push data to the browser. It integrates with ColdFusion very nicely through the use of an event gateway. This is a feature that was unavailable in Flex 1.5, and can be very powerful in some applications.
Those are the important pieces of Flex. You can download the Flex components from the Adobe Website at www.adobe.com/cfusion/tdrc/index.cfm?product=flex. You can update your Flash player at www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash. For the remainder of this article, I'm going to give you an introduction in how Flex and ColdFusion work together. When working with Flex 2 and ColdFusion, you'll want to install the ColdFusion 7.02 updater. You can download that from www.adobe.com/support/coldfusion/downloads_updates.html .

Accessing a CFC from Flex
Flex can call CFCs directly using Flash Remoting; an update to ColdFusion's Flash Remoting components is located in the 7.02 updater. This update helps ColdFusion talk to something you built in Flex. To demonstrate, I'll start with a simple helloworld.cfc:

<cfcomponent>
<cffunction name="GetHello" output="false" access="remote" returntype="string">
    <cfreturn "Hello World">
    </cffunction>
</cfcomponent>

If you are not familiar with CFCs, there are a plethora of resources for learning about them. You might start with one of my previous columns on them at http://coldfusion.sys-con.com/read/47203.htm. This component has no instance variables and only contains a single "GetHello" method. The method returns the string "Hello World." This is simple stuff, and you all know it, right? Great, let's look at some Flex code!

First, you'll need to define a Flex application, like this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
</mx:Application>

All the MXML code that you write will go in the mx:Application block. In CFML, all tags start with CF. In MXML, all tags start with "mx:". Code blocks work the same way in either language. The mx:Application works, conceptually, the same way that a cfloop does. Now we can add a label and a button to our code:

<mx:Label id="Result" x="59" y="58"/>
<mx:Button x="154" y="56" label=" Get Hello"/>

Remember that this code goes in the mx:Application block. I used Flex Builder 2 to easily place the label and button, but if you are using the SDK without Flex Builder, you can specify the location of the elements using the x and y coordinates as shown in the code. This code will show you an empty label with a button next to it. The label, at present, doesn't contain any text. The button displays the text "GetHello" but doesn't actually do anything yet. The label is given an ID "result". This is so we can reference it later to assign it a value. I did not give the button an ID because we won't need to access it programmatically.

Next you need to tell Flex how to find your CFC. To do that, I used the RemoteObject tag and placed this code in my MXML file:

<mx:RemoteObject id="helloWorld" destination="ColdFusion" source="htdocs.experiments.flex.helloworld">
    <mx:method name="GetHello" result="GetHello_handler(event)" />
</mx:RemoteObject>

More Stories By Jeffry Houser

Jeffry is a technical entrepreneur with over 10 years of making the web work for you. Lately Jeffry has been cooped up in his cave building the first in a line of easy to use interface components for Flex Developers at www.flextras.com . He has a Computer Science degree from the days before business met the Internet and owns DotComIt, an Adobe Solutions Partner specializing in Rich Internet Applications. Jeffry is an Adobe Community Expert and produces The Flex Show, a podcast that includes expert interviews and screencast tutorials. Jeffry is also co-manager of the Hartford CT Adobe User Group, author of three ColdFusion books and over 30 articles, and has spoken at various events all over the US. In his spare time he is a musician, old school adventure game aficionado, and recording engineer. He also owns a Wii. You can read his blog at www.jeffryhouser.com, check out his podcast at www.theflexshow.com or check out his company at www.dot-com-it.com.

Comments (1) 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
Web Developer's & Designer's Journal 08/10/06 04:30:18 PM EDT

I'm going to postpone the second part of my RSS aggregator article to tie this column into this Flex-themed issue. Have no fears, though, it will be back in full force in the next issue. Flex, as I'm sure most people know, is a way for programmers (you, me, and us) to create Flash movies.

@ThingsExpo Stories
High-velocity engineering teams are applying not only continuous delivery processes, but also lessons in experimentation from established leaders like Amazon, Netflix, and Facebook. These companies have made experimentation a foundation for their release processes, allowing them to try out major feature releases and redesigns within smaller groups before making them broadly available. In his session at 21st Cloud Expo, Brian Lucas, Senior Staff Engineer at Optimizely, will discuss how by using...
SYS-CON Events announced today that Taica will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. ANSeeN are the measurement electronics maker for X-ray and Gamma-ray and Neutron measurement equipment such as spectrometers, pulse shape analyzer, and CdTe-FPD. For more information, visit http://anseen.com/.
SYS-CON Events announced today that Daiya Industry will exhibit at the Japanese Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Ruby Development Inc. builds new services in short period of time and provides a continuous support of those services based on Ruby on Rails. For more information, please visit https://github.com/RubyDevInc.
Nordstrom is transforming the way that they do business and the cloud is the key to enabling speed and hyper personalized customer experiences. In his session at 21st Cloud Expo, Ken Schow, VP of Engineering at Nordstrom, will discuss some of the key learnings and common pitfalls of large enterprises moving to the cloud. This includes strategies around choosing a cloud provider(s), architecture, and lessons learned. In addition, he’ll go over some of the best practices for structured team migrat...
As businesses evolve, they need technology that is simple to help them succeed today and flexible enough to help them build for tomorrow. Chrome is fit for the workplace of the future — providing a secure, consistent user experience across a range of devices that can be used anywhere. In her session at 21st Cloud Expo, Vidya Nagarajan, a Senior Product Manager at Google, will take a look at various options as to how ChromeOS can be leveraged to interact with people on the devices, and formats th...
SYS-CON Events announced today that Yuasa System will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Yuasa System is introducing a multi-purpose endurance testing system for flexible displays, OLED devices, flexible substrates, flat cables, and films in smartphones, wearables, automobiles, and healthcare.
Join IBM November 1 at 21st Cloud Expo at the Santa Clara Convention Center in Santa Clara, CA, and learn how IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Cognitive analysis impacts today’s systems with unparalleled ability that were previously available only to manned, back-end operations. Thanks to cloud processing, IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Imagine a robot vacuum that becomes your personal assistant tha...
Organizations do not need a Big Data strategy; they need a business strategy that incorporates Big Data. Most organizations lack a road map for using Big Data to optimize key business processes, deliver a differentiated customer experience, or uncover new business opportunities. They do not understand what’s possible with respect to integrating Big Data into the business model.
Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection between Coke and its customers. Digital signs pair software with high-resolution displays so that a message can be changed instantly based on what the operator wants to communicate or sell. In their Day 3 Keynote at 21st Cloud Expo, Greg Chambers, Global Group Director, Digital Innovation, Coca-Cola, and Vidya Nagarajan, a Senior Product Manager at Google, will discuss how from store operations...
Recently, REAN Cloud built a digital concierge for a North Carolina hospital that had observed that most patient call button questions were repetitive. In addition, the paper-based process used to measure patient health metrics was laborious, not in real-time and sometimes error-prone. In their session at 21st Cloud Expo, Sean Finnerty, Executive Director, Practice Lead, Health Care & Life Science at REAN Cloud, and Dr. S.P.T. Krishnan, Principal Architect at REAN Cloud, will discuss how they bu...
SYS-CON Events announced today that Dasher Technologies will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Dasher Technologies, Inc. ® is a premier IT solution provider that delivers expert technical resources along with trusted account executives to architect and deliver complete IT solutions and services to help our clients execute their goals, plans and objectives. Since 1999, we'v...
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities – ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups. As a result, many firms employ new business models that place enormous impor...
SYS-CON Events announced today that TidalScale, a leading provider of systems and services, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. TidalScale has been involved in shaping the computing landscape. They've designed, developed and deployed some of the most important and successful systems and services in the history of the computing industry - internet, Ethernet, operating s...
SYS-CON Events announced today that Taica will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Taica manufacturers Alpha-GEL brand silicone components and materials, which maintain outstanding performance over a wide temperature range -40C to +200C. For more information, visit http://www.taica.co.jp/english/.
SYS-CON Events announced today that MIRAI Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MIRAI Inc. are IT consultants from the public sector whose mission is to solve social issues by technology and innovation and to create a meaningful future for people.
As hybrid cloud becomes the de-facto standard mode of operation for most enterprises, new challenges arise on how to efficiently and economically share data across environments. In his session at 21st Cloud Expo, Dr. Allon Cohen, VP of Product at Elastifile, will explore new techniques and best practices that help enterprise IT benefit from the advantages of hybrid cloud environments by enabling data availability for both legacy enterprise and cloud-native mission critical applications. By rev...
SYS-CON Events announced today that Datera will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Datera offers a radically new approach to data management, where innovative software makes data infrastructure invisible, elastic and able to perform at the highest level. It eliminates hardware lock-in and gives IT organizations the choice to source x86 server nodes, with business model option...
With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend 21st Cloud Expo October 31 - November 2, 2017, at the Santa Clara Convention Center, CA, and June 12-14, 2018, at the Javits Center in New York City, NY, and learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
Infoblox delivers Actionable Network Intelligence to enterprise, government, and service provider customers around the world. They are the industry leader in DNS, DHCP, and IP address management, the category known as DDI. We empower thousands of organizations to control and secure their networks from the core-enabling them to increase efficiency and visibility, improve customer service, and meet compliance requirements.
Digital transformation is changing the face of business. The IDC predicts that enterprises will commit to a massive new scale of digital transformation, to stake out leadership positions in the "digital transformation economy." Accordingly, attendees at the upcoming Cloud Expo | @ThingsExpo at the Santa Clara Convention Center in Santa Clara, CA, Oct 31-Nov 2, will find fresh new content in a new track called Enterprise Cloud & Digital Transformation.