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
In his session at @ThingsExpo, Dr. Robert Cohen, an economist and senior fellow at the Economic Strategy Institute, presented the findings of a series of six detailed case studies of how large corporations are implementing IoT. The session explored how IoT has improved their economic performance, had major impacts on business models and resulted in impressive ROIs. The companies covered span manufacturing and services firms. He also explored servicification, how manufacturing firms shift from se...
WebRTC is the future of browser-to-browser communications, and continues to make inroads into the traditional, difficult, plug-in web communications world. The 6th WebRTC Summit continues our tradition of delivering the latest and greatest presentations within the world of WebRTC. Topics include voice calling, video chat, P2P file sharing, and use cases that have already leveraged the power and convenience of WebRTC.
SYS-CON Events announced today that CA Technologies has been named “Platinum Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business – from apparel to energy – is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
An increasing number of companies are creating products that combine data with analytical capabilities. Running interactive queries on Big Data requires complex architectures to store and query data effectively, typically involving data streams, an choosing efficient file format/database and multiple independent systems that are tied together through custom-engineered pipelines. In his session at @BigDataExpo at @ThingsExpo, Tomer Levi, a senior software engineer at Intel’s Advanced Analytics ...
SYS-CON Events announced today that Secure Channels, a cybersecurity firm, 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. Secure Channels, Inc. offers several products and solutions to its many clients, helping them protect critical data from being compromised and access to computer networks from the unauthorized. The company develops comprehensive data encryption security strategie...
Internet-of-Things discussions can end up either going down the consumer gadget rabbit hole or focused on the sort of data logging that industrial manufacturers have been doing forever. However, in fact, companies today are already using IoT data both to optimize their operational technology and to improve the experience of customer interactions in novel ways. In his session at @ThingsExpo, Gordon Haff, Red Hat Technology Evangelist, shared examples from a wide range of industries – including en...
Detecting internal user threats in the Big Data eco-system is challenging and cumbersome. Many organizations monitor internal usage of the Big Data eco-system using a set of alerts. This is not a scalable process given the increase in the number of alerts with the accelerating growth in data volume and user base. Organizations are increasingly leveraging machine learning to monitor only those data elements that are sensitive and critical, autonomously establish monitoring policies, and to detect...
"We're a cybersecurity firm that specializes in engineering security solutions both at the software and hardware level. Security cannot be an after-the-fact afterthought, which is what it's become," stated Richard Blech, Chief Executive Officer at Secure Channels, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. Jack Norris reviews best practices to show how companies develop, deploy, and dynamically update these applications and how this data-first...
Intelligent Automation is now one of the key business imperatives for CIOs and CISOs impacting all areas of business today. In his session at 21st Cloud Expo, Brian Boeggeman, VP Alliances & Partnerships at Ayehu, will talk about how business value is created and delivered through intelligent automation to today’s enterprises. The open ecosystem platform approach toward Intelligent Automation that Ayehu delivers to the market is core to enabling the creation of the self-driving enterprise.
The question before companies today is not whether to become intelligent, it’s a question of how and how fast. The key is to adopt and deploy an intelligent application strategy while simultaneously preparing to scale that intelligence. In her session at 21st Cloud Expo, Sangeeta Chakraborty, Chief Customer Officer at Ayasdi, will provide a tactical framework to become a truly intelligent enterprise, including how to identify the right applications for AI, how to build a Center of Excellence to ...
SYS-CON Events announced today that Massive Networks 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. Massive Networks mission is simple. To help your business operate seamlessly with fast, reliable, and secure internet and network solutions. Improve your customer's experience with outstanding connections to your cloud.
SYS-CON Events announced today that Datera, that offers a radically new data management architecture, has been named "Exhibitor" of 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 is transforming the traditional datacenter model through modern cloud simplicity. The technology industry is at another major inflection point. The rise of mobile, the Internet of Things, data storage and Big...
Everything run by electricity will eventually be connected to the Internet. Get ahead of the Internet of Things revolution and join Akvelon expert and IoT industry leader, Sergey Grebnov, in his session at @ThingsExpo, for an educational dive into the world of managing your home, workplace and all the devices they contain with the power of machine-based AI and intelligent Bot services for a completely streamlined experience.
Because IoT devices are deployed in mission-critical environments more than ever before, it’s increasingly imperative they be truly smart. IoT sensors simply stockpiling data isn’t useful. IoT must be artificially and naturally intelligent in order to provide more value In his session at @ThingsExpo, John Crupi, Vice President and Engineering System Architect at Greenwave Systems, will discuss how IoT artificial intelligence (AI) can be carried out via edge analytics and machine learning techn...
In his session at @ThingsExpo, Arvind Radhakrishnen discussed how IoT offers new business models in banking and financial services organizations with the capability to revolutionize products, payments, channels, business processes and asset management built on strong architectural foundation. The following topics were covered: How IoT stands to impact various business parameters including customer experience, cost and risk management within BFS organizations.
SYS-CON Events announced today that CA Technologies has been named "Platinum Sponsor" of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business - from apparel to energy - is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
From 2013, NTT Communications has been providing cPaaS service, SkyWay. Its customer’s expectations for leveraging WebRTC technology are not only typical real-time communication use cases such as Web conference, remote education, but also IoT use cases such as remote camera monitoring, smart-glass, and robotic. Because of this, NTT Communications has numerous IoT business use-cases that its customers are developing on top of PaaS. WebRTC will lead IoT businesses to be more innovative and address...
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devic...
WebRTC is great technology to build your own communication tools. It will be even more exciting experience it with advanced devices, such as a 360 Camera, 360 microphone, and a depth sensor camera. In his session at @ThingsExpo, Masashi Ganeko, a manager at INFOCOM Corporation, will introduce two experimental projects from his team and what they learned from them. "Shotoku Tamago" uses the robot audition software HARK to track speakers in 360 video of a remote party. "Virtual Teleport" uses a...