In Chapter 1, I described the object-oriented concept of modularity and described how dividing an application into small pieces can increase developer productivity and improve long-term maintenance of an application. I also described the concept of encapsulation that encourages developers to create application building blocks that hide the details of a feature's implementation from the rest of the application, and only expose tools in the module's public interface that are needed to set and get the module's information and execute its functions.
In this chapter, I describe some of the basic building blocks of a Flex application that can improve its modularity and make it easier to manage over time. I start with a look at binding expressions and describe how they help you easily move data around an application. A binding expression can move data from one object to another at runtime without explicit event handling or ActionScript statements. I describe a couple of binding syntax styles and show when to use each.
This chapter also includes a description of how to create and use custom MXML components in a Flex application. In the last section of this chapter, I describe how to package and manage multiple components and classes in a component library, using a Flex Builder Library Project.
To use the sample code for this chapter, import the
chapter05.zip Flex project archive file from the Web site files into your Flex Builder workspace.