Accessibility

Flex Learning Path – Programmer

Your background: Experience with object-oriented programming
Your goal: Learn to build and architect rich Internet applications (RIAs) built in Flex

Build a basic data-driven application

Get inspired
In this task, you will browse rich Internet applications built in Flex that are used across a broad variety of industries and use cases. This will provide you with inspiration and ideas, let you see what Flex is capable of, and also give you a look at who is using Flex. Be sure to explore the Flex showcase which is a Flex application letting you browse and search for publicly available Flex applications. In addition to the companies included there, many other companies are developing Flex RIAs for internal applications where complex business processes are simplified by more interactive applications that display rich data. Oracle, SAP, Business Objects, and other enterprise software companies are also integrating Flex technology with their enterprise applications.
Learn how Flex works
In this task, you will get familiar with the tools and technologies you need to create rich Internet applications.
Make a Flex project
In this task, you will learn to use Flex Builder, a powerful authoring tool based on the popular Java development environment Eclipse, to create your first Flex project.
Add controls
In this task, you will learn to add controls to your application which allow you to display content (like text and images) and provide means for users to interact with the application. Be sure you use the Flex Component Explorer application to explore and see in action the more than 40 pre-built controls in the Flex framework. Controls can be separated into two main categories, simple controls (like the Label, Button, Image, DataChooser, ColorPicker, and HSlider controls) and dataProvider controls for which you need to provide a set of data to the component to populate it (like the ComboBox, List, DataGrid, or Tree controls).
Organize layout
In this task, you will learn to build user interfaces by placing controls inside of containers. Containers are Flex components in which children are positioned using absolute positioning (where you specify in pixels where the components should be placed) or relative positioning (where the container has an algorithm it uses to position the children relative to each other). You can build fluid or flexible interfaces which fill the browser window and respond (or resize) when the browser window changes size using relative percentage-based sizes for controls and containers or using constraint-based layouts in absolute containers.
Respond to gestures and events
In this task, you will learn to respond to user gestures and events in the application by registering to listen to and responding to events broadcast by the various framework components. You can register to listen for events inline in MXML or in ActionScript using the EventDispatcher addEventListener() method. Registering in MXML can be the quickest and most concise, but registering to listen in ActionScript enables complete separation of logic and views and also provides more advanced event handling capabilities. You also learn about the event object which is broadcast with every event and contains info about the event that occurred and how to use the Flex Builder debugger.
Separate application into multiple views
In this task, you will learn to separate your application into multiple views. Each view is a separate MXML component which is turned, by the MXML parser, into an ActionScript class that extends one of the classes in the Flex framework. Separating your views into distinct components allows the components to be reused in multiple places, enables multiple developers to work on the application at the same time, and provides better maintainability and scalability for the application.
Change views" >
In this task, you will learn the two ways to change what the user sees in an application: using navigation and view states. You use navigation and navigator containers to switch between completely different views. You use view states to make modifications to an existing view.
Learn how to talk to the server
In this task, you will learn the options for talking to back-end data and business logic. You can make requests to the server using HTTP requests (to request XML files, application server pages, or REST-style web services), web services (to request operations of SOAP-based services), or Flash Remoting (to invoke methods of application server classes). Flash Remoting uses the open-source protocol AMF (Action Message Format, a binary, serialized data transport format) to provide a fast, efficient means of transporting data to your application which accelerates application performance.

The Flash Player operates within a security sandbox that limits Flex applications to only be able to access data resources on the same domain and by the same protocol from which the SWF was served. If you want to make a request to a different domain, that server needs to install a cross-domain policy file that grants access from your application's domain. This is not always possible for publicly available data and services. In this case you need to use your application server to proxy the request, either by writing a class to do so, or by using the proxy service of BlazeDS, LiveCycle Data Services DS, or an application with similar functionality.
Get data from an XML file
In this task, you will learn to get XML data from the server. You can make an HTTP request to the server to retrieve a static XML file or to request an application server page (like a page created as CFM, PHP, JSP, and so on) that returns XML. You can work with the returned data as arrays and objects or as native ECMAScript XML.
Create visual objects dynamically
In this task, you will learn to create visual objects dynamically. You can create them in MXML using the Repeater component or in ActionScript by creating the visual object and then adding it to a container using the container's addChild() or addChildAt() method.
Customize data displayed in components
In this task, you will learn to customize the data that is displayed in dataProvider components. By default, the data displayed matches that in the dataProvider for the control. To format the text, concatenate multiple fields, or manipulate the text in any way, you can use the labelFunction property of the control. In addition to formatting the text string which is displayed, you can also specify a renderer, a component to be used to render or display the contents of each item in the component.
Use web services to talk to remote functionality
In this task, you will learn to call a SOAP-based web service. SOAP is an XML-based format that you can use for exchanging structured and typed data between a Flex application and a web service. You typically use web services to invoke third-party remote functionality and use Flash Remoting to communicate with your own server. To learn about Flash Remoting, see the subsequent task Use Flash Remoting to talk to the server.
Use Flash Remoting to talk to the server
In this task, you will learn to use Flash Remoting to call methods of server-side classes without having to publish them as web services. Flash Remoting is a gateway that you install on your application server that handles routing the requests between the client and the server-side classes, the data serialization and deserialization, and the mapping of client and server-side data types. Flash Remoting and its protocol AMF (Action Message Format, a binary representation of the data) are now open-sourceand implementations can be found for most application servers.Flash Remoting is built into ColdFusion 6 or later. For Java servers, you can install BlazeDS or LiveCycle Data Services DS. For other application servers, there are other community or third-party products that provide the remoting functionality. For additional info for specific servers, see the following tasks in the Designer/Developer track: Use Flash Remoting to talk to a ColdFusion server, Use Flash Remoting to talk to a PHP server, Use Flash Remoting to talk to a .NET server.
Work with forms
In this task, you will learn to create forms and validate form field data using the Flex framework Validator classes. In addition to providing the logic for validating form fields, these validators also provide visual feedback to the users when the input fails validation.
Manipulate data on the client
In this task, you will learn to manipulate client-side data. You often work with client-side data as Flex framework collections (typically ArrayCollections or XMLListCollections) that can be bound to views and automatically notify and update the views when any of the data in the collection changes. In this task, you will learn to format data using the Flex framework formatter classes; to filter, sort, and traverse collections using methods of the collection classes; and to manipulate XML using the E4X (ECMAScript for XML) operators.
Deploy the application
In this task, you will learn to deploy an application as both a browser and desktop AIR application. You can manually deploy an application using Flex Builder to compile a release-build to the server or you can automate the application deployment using industry-standard Ant tasks, which enable you to quickly and easily set up complex build processes for your applications. Flex Ant tasks include two compiler tasks, mxmlc and compc, that extend the Java Ant task. It also includes an HTML-wrapper task that lets you generate custom HTML wrappers and the supporting files for those wrappers.

Architect an application

Exchange data between components
In this task, you will learn to exchange data between components by defining and broadcasting custom events. When your application is larger than a single class, you will need to use data from and respond to events of one component in another and vice versa. The way you DON'T want to do this, is by referring to these nested objects or events directly using dot notation; this creates tightly-coupled components and applications that are very difficult to maintain and scale. Instead you want to create loosely-coupled components that only communicate through their APIs: their properties, methods, and events. What you learn in this task is to create custom components with their own custom events just like those in the Flex framework.
Learn about Flex GUI design patterns
In this task, you will learn about the design patterns used to create Flex applications. Everything in Flex is event based; for any code to execute, you have to register to listen for and define handlers to respond to events. In order to create code that is easy to maintain and scale, you should at least implement a basic model-view-controller pattern in which your data is separated from your views and your event handling logic. This has been facilitated by the Flex framework with the concept of data binding, which enables you to concisely register your views to be notified and updated whenever the data used to populate them changes. When your application is larger than a single class, you need to exchange data between components by broadcasting and listening for custom events whose associated event object you can define custom properties. For more info on broadcasting events, see the previous task Exchange data between components. As your application continues to grow, you need to continue to separate and apply patterns to facilitate maintenance and updating and you may soon graduate into needing an architecture framework. To learn more about architecture frameworks, see the subsequent tasks Build applications with the Cairngorm framework and/or Check out other Flex microarchitectures in this Programmer path.
Reduce SWF size
In this task, you will learn to decrease the size of your application using release builds, the Flash Player framework cache, modules, and runtime shared libraries. As your application continues to grow in features, the SWF may become too large to ensure quick enough download by your clients. If there is application functionality that not every client will use or may not be used right away, you can split it into a module; a module is compiled into its own SWF and then is loaded at runtime via code. If you have multiple applications that share some of the same code libraries, you can use runtime-shared libraries to only require the code be downloaded once and used by both applications during the browser session. Note, only Adobe signed runtime-shared libraries can persist on the client and be cached by the Flash Player after the browser is closed. This is a new feature available in Flash Player 9 Update 3 (9,0,115,0) that enables the Flex framework to be cached and used by Flex applications from any domain.
Build custom components
In this task, you will learn to build custom Flex components. Components can be built either with Flex or Flash (Flash CS3 Professional and later has a tool to export as a Flex component). Flex based components can range from simple components that just extend components in the Flex framework by adding properties and methods, to more advanced components for which you add custom events or styles, to more advanced components that override methods of UIComponent, the base class of all Flex components. The latter requires an understanding of the Flex component life cycle including what methods are called when in the creation and update processes that occur in an application. To learn about creating and using components created in Flash, see the subsequent task Use components created in Flash in this Programmer path.
Use components created in Flash
In this task, you will learn to use components created in Flash. Flex works great for creating components that extend those in the Flex framework. What if you want something much more custom, though, like a component that is an image of a car whose pieces you can click to add them to an insurance claim being created for an accident? This could be done in Flex, but would probably be much harder and take longer (if you know Flash) than creating it in Flash. One of the strengths of Flash is creating animated, interactive, highly visual content. With Flash CS3 Professional and later, you can create a symbol in Flash and then export it as Flex component so it can be used in applications just like a normal Flex framework component.
Learn about Flex microarchitectures
In this task, you will get introduced to the concept of using a microarchitecture, a collection of design patterns, to build medium to large-scale applications. For more details on specific microarchitectures, see the subsequent Build applications with the Cairngorm framework and Check out other Flex microarchitectures tasks in this Programmer path.
Build applications with the Cairngorm framework
In this task, you will learn about the Cairngorm microarchitecture, one of many architecture frameworks that you can use to build medium to large-scale applications. Cairngorm was originally developed by the software consultancy iteration::two and then released by them as an open-source project for Flex in 2004. It is used extensively by Adobe Consulting to help numerous customers and partners successfully deliver large-scale Flex RIAs. To decide if you should use a microarchitecture, see the previous Learn about Flex microarchitectures task. To learn about other Flex microarchitectures, see the subsequent Check out other Flex microarchitectures task.
Check out other Flex microarchitectures
In this task, you will explore other microarchitectures that have been developed for building medium to large-scale applications. To decide if you should use a microarchitecture, see the previous Learn about Flex microarchitectures task. To learn about the Cairngorm microarchitecture, see the previous Build applications with the Cairngorm framework task.

Enhance application functionality

Build a messaging application
In this task, you will learn to build a messaging application. A messaging application is a collaborative application in which data is pushed from the server to the client whenever it receives it; the client does not have to explicitly ask for specific data using one of the remote procedure call methods (HTTP requests, web services, or Flash Remoting calls). You use the Flex Producer and Consumer classes to build applications that can produce (send data to the server), consume (receive data form the server), or both. Examples of collaborative applications range from a simple chat application, to a shared whiteboard like in Adobe Connect, to a real-time data management application in which data is simultaneously updated on the client, the database on the server, and in other Flash Player clients viewing the data. In order to build a collaborative application, you need to install BlazeDS or LiveCycle Data Services ES (for Java and ColdFusion servers) or an application with equivalent functionality for other application servers.
Build social apps using hosted services
In this task, you will learn to add real-time social capabilities to your applications using Adobe Flash Collaboration Service (formerly code named Cocomo), a Platform as a Service that lets you easily add VoIP audio, webcam video, chat, multi-user whiteboards, real-time file sharing, user management, roles and permissions, and robust data messaging. The Flash Collaboration Service consists of both Flex-based client components and a hosted services infrastructure, hosted at Acrobat.com so issues like deployment, maintenance, and scalability are taken care of for you.
Build a collaborative data application
In this task, you will learn to use the data management service (of Live Cycle Data Services ES for Java or ColdFusion servers or a third-party product like WebORB for other application servers) to build a collaborative data application. A common collaborative data application would be one that presents data from a database to the clients, allows the clients to edit the data, saves the changes to the database on the server, and then pushes those changes out to any other clients using the application. You can accomplish this task using a combination of Flash Remoting (or other remote procedure call methods) and messaging. You can also accomplish this task with the data management service writing a lot less client-side code and a little more setup in server-side configuration files. Additionally, it provides support for on-demand data paging, interaction with occasionally connected application services, and a custom assembler for integrating with the Hibernate data-persistance framework.
Save data
In this task, you will learn to save application data locally on the client computer using three different methods. You can save data using shared objects, the Flash Player version of cookies. Shared objects are generally used to save user preferences or non-secure user-based application data between sessions. You can also use the Flash Player FileReference class to download (and upload) files from the server and new to Flash Player 10, to directly save (and load) files from the client computer.
Enable browser navigation
In this task, you will learn to enable browser navigation of your application. Traditional web applications are groups of pages that are individually requested and sent to the browser. The client traverses these pages and bookmarks specific pages to return to them later. With a Flex application, you have one web page which contains your entire application; when clients click the browser back button, they will be returned to whatever web page they were previously viewing. Clients are used to interacting this way with the browser, so for usability, you need to continue to let them do so. You enable bookmarking by using deep linking in the Flex framework which adds URL-mapping and bookmarking capabilities to Flex applications. This works by creating unique URLs for different application states so that new entries are created in the browser's history. Because this entails communication between JavaScript in the container HTML page and the Flex SWF, deep-linking is only supported by certain browsers. To learn more about ActionScript/JavaScript communication, see the subsequent Access JavaScript from Flex and vice versa task.
Access JavaScript from Flex and vice versa
In this task, you will learn how to get JavaScript and ActionScript to communicate. The easiest way to call JavaScript functions from your Flex application is to use the static call() method of the Flash Player ExternalInterface class, passing to it the name of the JavaScript function and any argument values. Any data returned by the JavaScript function will be returned by the call() method. To call ActionScript functions from JavaScript, you create a public ActionScript function, and then register it as callable from JavaScript using the static addCallback() method of the ExternalInterface class. You can pass primitives, numbers, and strings as properties on objects, arrays of simple types, and arrays of simple objects using this method. To exchange more complex or strongly-typed objects, you need to use the Flex Ajax Bridge which is a small, unobtrusive code library (now part of the Flex SDK).
Build multilingual applications
In this task, you will learn to build multilingual applications. You create resource properties files and then either bind values from the resource to an expression using the @Resource directive or use methods of the ResourceBundle class to access those values. You can compile multiple locales (resource bundles) into a single SWF or or create resource modules from the properties files and load them at runtime, allowing you to change locale on the fly.
Build accessible applications
In this task, you will learn to build accessible applications. Flex 3 includes 28 components with support for accessibility built in, automating many of the most common accessibility practices such as providing text equivalents, labeling controls, and promoting keyboard access. You need to tell the compiler explicitly to use these accessible versions of the components because they increase the size of the application.
Customize the application
In this task, you will learn to change the look of components in your application using styles and style sheets. You learn where to find styles for a component, how to set styles for an individual component inline in MXML or in ActionScript, and how to create and use a style sheet containing global, type, and class selectors. New in Flex Builder 3, you can interactively set and preview styles on any component in Flex Builder Design view. Although you can set styles for an individual component inline, for maintenance reasons, you should try to set all your styles in a style sheet. Styles give you a lot of freedom in customizing the look of the application without having to do much. If you want to change the look of a component in a way that cannot be accomplished with styles, though, you need to "skin" the component either graphically or programmatically. To learn more about skinning, see the Graphically skin components and/or Programmatically skin components tasks in the Designer/Developer path.
Add animation
In this task, you will learn to add animation to your application. Motion should not be used gratuitously, but is essential to good application design making applications more useful, usable, and desirable. You should use motion to provide feedback and focus your users' attention, eliminate jerky jumps, and help guide users to the next area of interest and make it clear how to return. Flex has many pre-built effects (including Fade, Rotate, Zoom, WipeLeft, and others) which you can use alone or in parallel or sequence with other effects. When you use view states, you can define transitions in which one or more effects are grouped together to play when a view state change occurs. To learn more about view states, go to the Change views task.
Add drag-and-drop
In this task, you will learn to add drag-and-drop functionality to your application. The list-based controls (DataGrid, HorizontalList, List, PrintDataGrid, TileList, and Tree) have built-in drag-and-drop support; all you have to do is set properties dragEnabled and dropEnabled to true. To use drag-and-drop support with any Flex component or to customize the drag-and-drop support with list-based components, you must handle the drag-and-drop events yourself using listeners and the DragManager class.
Visualize data
In this task, you will learn about the Flex components available to visualize your data. With Flex Builder 3 Professional, you get a set of advanced visualization components in addition to the standard Flex framework components; these include Bar, Column, Line, Area, Plot, Bubble, Pie, CandleStick, and HLOC charts; an advanced DataGrid; and an OLAPDataGrid. You can style, skin, and customize the charts; add legends; animate data series; add components or drawing on top of the chart; have multiple axes; and more. These components are augmented by the components created by iLOG including 3D charts, gauges and dials, calendars, map displays, Gantt charts, organizational charts, tree maps and radar charts.
Add video and sound
In this task, you will learn to add video and sound to your application. You can deliver FLV-formatted video using the Flex VideoDisplay component or custom Flash video display components. You can play MP3 files using the Sound class.
Add mapping capabilities
In this task, you will learn how to create Flex and mapping mashups.