Lesson 7. Creating Components with MXML

What You Will Learn

In this lesson, you will:

  • Understand the need for components and how they can fit into a bigger application architecture scheme

  • Understand the class hierarchy used in Flex

  • Build both visual and nonvisual components

  • Instantiate and use custom components

  • Create properties and methods in custom components

  • Create a pop-up window and learn how to close it

  • Create a value object ActionScript class

Approximate Time

This lesson takes approximately 3 hours to complete.

Lesson Files

Media Files:


Starting Files:




Completed Files:










You have used many components while building the three applications to their current state. Every time you use an MXML tag, you are actually using a component. In fact, Flex is considered to be a component-based development model. In this lesson you'll learn how to create your own components. The custom components you build will either extend functionality of components or group functionality of components.

Up to this point, you do not have a way to break up your application pages. The application would continue to get longer and longer and become more difficult to build, debug, and maintain. It would also be very difficult for a team to work on one large application page. Components let you divide the application into modules, which you can develop and maintain separately. With careful planning, these components can become a reusable suite of application functionality.

A simple component

You will need to learn two things in this lesson. The first is how to build components. You must learn the syntax and rules surrounding how to create and use the custom components you build. Second, is to learn why you'd want to do this and how components can affect your overall application architecture. In the "Introducing MXML Components" section, an overview of how to build components will be given. Then in the tasks throughout the rest of the lesson, you will reinforce your component-building skills and continue to learn more and more details about building custom components. The lesson introduction includes a theoretical discussion of why you would want to use components. The rest of the lesson will use an architectural approach to implementing components.

Adobe Flex 2.Training from the Source
Adobe Flex 2: Training from the Source
ISBN: 032142316X
EAN: 2147483647
Year: 2006
Pages: 225

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net