Specifications

91
Chapter 5: Improving Startup
Performance
Adobe® Flex® helps you improve the actual and perceived startup times of your Flex applications. You can do this
by deferring the creation of certain controls until a later time, or customize the order in which containers are
created and displayed in your applications.
Topics
About startup performance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
About startup order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Using deferred creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Creating deferred components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Using ordered creation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101
Using the callLater() method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107
About startup performance
You could increase the startup time and decrease performance of your applications if you create too many objects
or put too many objects into a single view. To improve startup time, minimize the number of objects that are
created when the application is first loaded. If a user-interface component is not initially visible at startup, avoid
creating that component until you need it. This is called deferred creation. Containers that have multiple views,
such as an Accordion container, provide built-in support for this behavior. You can use ActionScript to customize
the creation order of multiple-view containers or defer the creation of other containers and controls.
After you improve the actual startup time of your application as much as possible, you can improve perceived
startup time by ordering the creation of containers in the initial view. The default behavior of Flex is to create all
containers and their children in the initial view, and then display everything at one time. The user will not be able
to interact with the application or see meaningful data until all the containers and their children are created. In
some cases, you can improve the user’s initial experience by displaying the components in one container before
creating the components in the next container. This process is called ordered creation.