User Guide
Improving application start-up time and performance 69
You could replace the previous layout with the following layout to achieve the same effect:
<mx:VBox>
<mx:Button label="Visa"/>
<mx:Button label="MasterCard"/>
<mx:Button label="Diner's Club"/>
<mx:Button label="AmEx"/>
</mx:VBox>
Improving effect performance
If animations in an application do not play smoothly, background processing might be interfering
with the animation. Effects have a public property called
suspendBackgroundProcessing.
When this property is
true, it blocks all background processing while the effect is playing,
including measurement and layout and data service response. The default value is
false. You
should be careful when you set this property to
true because it makes an effect completely
uninterruptible while playing.
Large-scale transition effects applied to complex views can affect how quickly the player can
redraw the view. When this happens, you will notice the effect does not play smoothly. The
following tips describe ways to modify an application to make effects play more evenly:
• Increase the duration of an effect to spread out the distinct, jerky stages over a longer period of
time, which allows the eye to fill in the differences.
• Hide part of the application that is playing an effect to make the effect play more smoothly,
because there is less for Flash Player to redraw. To do this, you use the
effectStart and
effectEnd events to control what is visible before and after the effect. For example, if you
apply a Fade effect to a Form with many controls, you can use the
effectStart event to make
some of the less important controls invisible, have the Form container play the Fade effect, and
then use the
effectEnd event to make the controls visible again.
• Use a solid backgroundColor to improve an effect’s performance. If you want a slight gradient
instead of a solid color, use a
backgroundImage that is a SWF file or an SVG file instead of a
bitmap image. Using bitmap images in backgrounds can slow down effects. Designers often
give their views a
backgroundImage that is a solid colors with gradients or patterns.
Using a wait state animation
When the child containers of navigator containers are heavily populated, users experience a wait
period when they navigate to a new view. You can create an animation to indicate this fact. The
extras directory of the flex.war file includes a sample application with a TabNavigator container
that displays a precompiled SWF animation during wait states. View the source of the app.mxml
file in the extras/NavigatorWaitState directory of your Flex installation to see how the
TabNavigator container catches the
change event and displays the embedded SWF file as a wait
symbol. When the child views broadcast their
draw events, indicating they have finished drawing
their contents, the TabNavigator container destroys the wait symbol.