UIObject.invalidate()

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

componentInstance.invalidate()

Returns

Nothing.

Description

Method; marks the object so it is redrawn on the next frame interval.

This method is primarily useful to developers of new custom components. A custom component is likely to support a number of operations that change the component's appearance.

Often, the best way to build a component is to centralize the logic for updating the component's appearance in the draw() method. If the component has a draw() method, you can call invalidate() on the component to redraw it. (For information on defining a draw() method, see Defining the draw() method in Using ActionScript 2.0 Components.)

All operations that change the component's appearance can call invalidate() instead of redrawing the component themselves. This has some advantages: code isn't duplicated unnecessarily, and multiple changes can easily be batched up into one redraw, instead of causing multiple, redundant redraws.

Example

The following example marks the ProgressBar instance pBar for redrawing:

pBar.invalidate();

Flash CS3