Implementing The Commitproperties() Method; Implementing The Measure() Method - MACROMEDIA FLEX-CREATING ADVANCED COMPONENTS Manual

Creating advanced components
Table of Contents

Advertisement

Application performance is better when you pass style properties in the
instead of calling the
The following example creates TextInput and SimpleButton components:
function createChildren():Void {
if (text_mc == undefined)
createClassObject(TextInput, "text_mc", 0, { preferredWidth: 80,
editable:false });
text_mc.addEventListener("change", this);
text_mc.addEventListener("focusOut", this);
if (mode_mc == undefined)
createClassObject(SimpleButton, "mode_mc", 1,
{falseUpSkin:modeUpSkinName, falseOverSkin: modeOverSkinName,
falseDownSkin: modeDownSkinName });
mode_mc.addEventListener("click", this);
}
At the end of the
(
,
invalidate()
information, see

Implementing the commitProperties() method

Flex calls the
commitProperties()
variables that are used by the
attributes have been applied.
Flex only calls the
method.
For example, the ViewStack container uses the
performance. When you set the
does not display a new page right away. Instead, it privately stores a
property. When it is time for Flash Player to update the screen, Flex calls the
commitProperties()
commitProperties()
pendingSelectedIndex
You use the
commitProperties()
computationally expensive, redundant work. For example, if a script changes the
ViewStack.selectedIndex
times the display of the ViewStack container updates when the
By using the
commitProperties()
property 15 times, and then do the rendering only once.
This is most useful for properties that are computationally expensive to update. If setting a
property is inexpensive, you can avoid using the

Implementing the measure() method

Generally, Flex calls the
component's container sets the initial size and Flex calculates the preferred minimum and
maximum sizes. You can use the
although Macromedia does not recommend doing this when developing components.
10
Creating Advanced Components
method.
setStyle()
method, call the necessary invalidate methods
createChildren()
, or
invalidateSize()
"About invalidation" on page
method before it calls the
measure()
commitProperties()
ViewStack.selectedIndex
,
,
measure()
layoutChildren()
method, the ViewStack container checks to see whether the
property is set, and it updates the selected index at that time.
method to delay processing so that Flash Player avoids doing
property 15 times, you would want to minimize the number of
method, you can update the
method only once, when the component is instantiated. The
measure()
measure()
invalidateLayout()
17.
measure()
method after the constructor has finished and MXML
method after it calls the
commitProperties()
property, the ViewStack container
, and
draw()
selectedIndex
commitProperties()
method to explicitly set the size of the component,
argument
initObject
) to refresh the screen. For more
method. It lets you set
invalidateProperties()
method to maximize
pendingSelectedIndex
methods. In the
property changes.
pendingSelectedIndex
method.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents