Specifications
79ADOBE FLEX 3
Building and Deploying Adobe Flex 3 Applications
]]></mx:Script>
<mx:Button id="myButton" label="Click Me" click="applyStyles()"/>
<mx:Label id="myLabel" text="This is a label"/>
<mx:TextArea id="myTextArea" text="This is a TextArea"/>
</mx:Application>
When you pass false for the update parameter, Flash Player stores the selector but does not apply the style.
When you pass
true for the update parameter, Flash Player recomputes the styles for every visual component in
the application.
The
loadStyleDeclarations() method is similarly computationally expensive. When you load a new style
sheet, this method triggers an update to the display list by default. You can prevent Flash Player from applying or
clearing the new style sheets immediately by setting the
update parameter to false. When you chain calls to
loadStyleDeclarations() methods, set the update parameter to false for all calls except the last one.
Working with containers
Containers provide a hierarchical structure that lets you control the layout characteristics of container children.
You can use containers to control child sizing and positioning, or to control navigation among multiple child
containers.
When you develop your Flex application, try to minimize the number of containers that you use. This is because
most containers provide relative sizing and positioning, which can be resource-intensive operations, especially
when an application first starts.
One common mistake is to create a container that contains a single child. Sometimes having a single child in a
container is necessary, such as when you use the container’s padding to position the child. But try to identify and
remove containers such as these that provide no real functionality. Also keep in mind that the root of an MXML
component does not need to be a container.
Another sign of possibly too many containers is when you have a container nested inside another container, where
both the parent and child containers have the same type (for example, HBoxes).
Minimizing container nesting
It is good practice to avoid deeply nested layouts when possible. For simple applications, if you have nested
containers more than three levels deep, you can probably produce the same layout with fewer levels of containers.
Deep nesting can lead to performance problems. For larger applications, deeper nesting might be unavoidable.










