Accessibility

Flex Article

 

Components: Designing for Reusability


iteration::two

Steven Webster

Alistair McLeod

iteration::two

Comments
Created:
4 April 2005
User Level:
Intermediate

Note: The book excerpt linked to below is from Chapter 10 of Developing Rich Clients with Macromedia Flex by Alistair McLeod and Steven Webster, published by Macromedia Press.

Developing
          Rich Clients with Macromedia Flex

Components are the building blocks of all Flex applications—from navigator containers, which help guide the user through different child components, to layout containers, which control the size and positioning of their children, to the controls that make up a user interface. They define what’s seen by the user and how the user can interact with the application.

Flex ships with containers and controls, but at some point, you’ll want something a little bit different from what ships with Flex. There may be times when you want something completely new—a container or control that introduces features not available in any of the components that ship with Flex. You may even want to create your own custom application component to encapsulate a framework that all your applications use. Thankfully, Flex provides hooks into its component architecture for the building of such custom components.

In this chapter, you will learn how to create your own custom components, by using both MXML and ActionScript. The chapter discusses the various options, and when and why you would go down a certain path. Finally, you learn how components can be built outside of the Flex environment by using Macromedia Flash MX 2004 to produce packaged components that can then be reused by your Flex application.

Errata

Below are important errata that the authors have provided for Chapter 10 of the published book.

The authors would like to acknowledge Dan Harfleet for compiling the errata for this chapter. For further information on migration issues between Flex 1.0 and Flex 1.5, the authors suggest reading Migrating Flex Applications in the Flex documentation.

  • widthFlex and heightFlex attributes (pages 239 and 250)—You can now set width and height values as a percentage; the value being the percentage of the parent container that the component should span. (See "Migrating Flex Applications.")

Requirements

To complete this tutorial you will need to install the following software:

Flex 1.5

Download the complete chapter:

Buy the book:

Steven Webster and Alistair McLeod, Developing Rich Clients with Macromedia Flex, © 2005 iteration::two. Reproduced by permission of Pearson Education, Inc. publishing as Peachpit Press. All Rights Reserved.

About the author

Steven Webster is a technical director at iteration::two, a world-leading Rich Internet Application consultancy based in Edinburgh, Scotland. Steven is the author of Reality J2EE: Architecting for Flash MX and coauthored ActionScript 2.0 Design Patterns for Rich Internet Applications (ActionScript 2.0 Dictionary) and Developing Rich Clients with Macromedia Flex with Alistair McLeod. Steven speaks regularly at conferences and user group meetings on technical and business aspects of RIAs. Steven is the core contributor to the open-source Cairngorm project, a micro-architecture for RIAs based on J2EE patterns which was innovated by iteration::two over a number of Flash and Flex RIA developments.

Alistair McLeod is a development director at iteration::two, a world-leading Rich Internet Application consultancy based in Edinburgh, Scotland. Alistair coauthored ActionScript 2.0 Design Patterns for Rich Internet Applications (ActionScript 2.0 Dictionary) and Developing Rich Clients with Macromedia Flex with Steven Webster, and has spoken at industry conferences, including Macromedia MAX. A strong advocate of agile software development, Alistair is the core contributor to both the AS2Unit and FlexUnit unit-testing frameworks for the test-driven development of Rich Internet Applications. Alistair has led the development of several RIA projects into production, including the first European deployment of a Macromedia Flex project.