Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL
Help

Chapter 5: Improving Startup Performance > Using ordered creation - Pg. 99

ADOBE FLEX 3 101 Building and Deploying Adobe Flex 3 Applications Destroying components After you create a component, it continues to exist until the user quits the application or you detach it from its parent and the garbage collector destroys it. To detach a component from its parent container, you can use the removeChild() or removeChildAt() methods. You can also use the removeAllChildren() method to remove all child controls from a container. Calling these methods does not immediately delete the objects from memory. If you do not have any other refer- ences to the child, Adobe® Flash® Player garbage collects it at some future point. But if you have stored a reference to that child on some other object, the child is not removed from memory. For more information on using these methods, see the View class in the Adobe Flex Language Reference. Using ordered creation By default, Flex displays the Loading progress bar while it initializes an application. Only after all of the compo- nents in the application are initialized and laid out does Flex display any portion of the application. Using ordered creation, you can customize this experience and change the user's perception of how quickly the application starts. During initialization, Flex first creates all the containers, and then fills in each container with its children and data. Finally, Flex displays the application in its entirety. This causes the user to wait for the entire application to load before beginning to interact with it. However, you can instruct Flex to display the children of each container as its children are created rather than waiting for the entire application to finish loading. You do this using a technique called ordered creation. The following example shows a complex application that contains a single container at the top, and four containers across the bottom. This application implements ordered creation so that the contents of each container become visible before the entire application is finished loading.