Adobe Flex 3 Help

Setting UIComponent.cachePolicy on the effect target

An effect can use the bitmap caching feature in Adobe® Flash® Player to speed up animations. An effect typically uses bitmap caching when the target component's drawing does not change while the effect is playing.

For example, the Fade effect works by modifying the alpha property of the target component. Changing the alpha property does not change the way the target component is drawn on the screen. Therefore, caching the target component as a bitmap can speed up the performance of the effect. The Move effect modifies the x and y properties of the target component. Modifying the values of these properties does not alter the way the target component is drawn, so it can take advantage of bitmap caching.

Not all effects can use bitmap caching. Effects such as Zoom, Resize, and the wipe effects modify the target component in a way that alters the way it is drawn on the screen. The Zoom effect modifies the scale properties of the component, which changes its size. Caching the target component as a bitmap for such an effect would be counterproductive because the bitmap changes continuously while the effect plays.

The UIComponent.cachePolicy property controls the caching operation of a component during an effect. The cachePolicy property can have the following values:

CachePolicy.ON 

Specifies that the effect target is always cached.



CachePolicy.OFF 

Specifies that the effect target is never cached.



CachePolicy.AUTO 

Specifies that Flex determines whether the effect target should be cached. This is the default value. Flex uses the following rules to set the cacheAsBitmap property:



  • When at least one effect that does not support bitmap caching is playing on a target, set the target's cacheAsBitmap property to false.
  • When one or more effects that supports bitmap caching are playing on a target, set the target's cacheAsBitmap property to true.

Typically, you leave the cachePolicy property with its default value of CachePolicy.AUTO. However, you might want to set the property to CachePolicy.OFF because bitmap caching is interfering with your user interface, or because you know something about your application's behavior such that disabling bitmap caching will have a beneficial effect on it.