O'Reilly logo

Programming Flex 2 by Joey Lott, Chafic Kazoun

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Component Life Cycle

The life cycle that the component framework provides is an important aspect of the Flex framework. By understanding the component life cycle, you will be able to build better components more quickly.

Tip

Most of the Flex framework, and particularly the built-in component, is based on the same component life cycle discussed in this chapter. As such, not only is it helpful to learn the component life cycle for building custom components, but it is also helpful for understanding the Flex framework as a whole for building applications.

The component life cycle comprises three phases: initialization, update, and destruction. The initialization phase consists of three main steps: construction, attachment, and initialization (the latter not to be confused with the initialization phase of which it is a part). The initialization step is composed of its own steps. For instance, during the initialization step, the component dispatches the preinitialize event, calls the createChildren( ) internal method, dispatches the initialize event, goes through a full invalidation and validation, and finally dispatches the creationComplete event. At this point, the component has completed the initialization step. Figure 19-2 outlines the initialization phase and its steps.

Component life cycle during the initialization phase

Figure 19-2. Component life cycle during the initialization phase

The update phase comprises everything that occurs between ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required