Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 162

Creating and extending flex 2 components
Hide thumbs Also See for FLEX 2 - CREATING AND EXTENDING COMPONENTS:
Table of Contents

Advertisement

}
}
Implementing the measure() method
The
method sets the default component size, in pixels, and optionally sets the
measure()
component's default minimum size.
Flex schedules a call to the
occurs. The
measure()
method. When you use the
invalidateSize()
a container, Flex automatically calls the
When you set a specific height and width of a component, Flex does not call the
method, even if you explicitly call the
method if the
measure()
component is NaN.
In the following example, because you explicitly set the size of the Button control, Flex does
not call the
Button.measure()
<mx:Button height="10" width="10"/>
In a subclass of an existing component, you might implement the
you are performing an action that requires modification to the default sizing rules defined in
the superclass. Therefore, to set a new default size, or perform calculations at run time to
determine component sizing rules, implement the
You set the following properties in the
Properties
measuredHeight
measuredWidth
measuredMinHeight
measuredMinWidth
The
method only sets the default size of the component. In the
measure()
updateDisplayList()
size, which may be different than the default size.
162
Creating Advanced Visual Components in ActionScript
method when a call to the
measure()
method executes during the next
invalidateSize()
invalidateSize()
explicitWidth
method:
measure()
Characteristics Description
Default height
Specifies the default height and width of the
and width
component, in pixels.
These properties are set to 0 until the measure()
method executes. Although you can leave them set
to 0, it makes the component invisible by default.
Default minimum
Specifies the default minimum height and minimum
height and width
width of the component, in pixels. Flex cannot set
the size of a component smaller than its specified
minimum size.
method, the parent container of the component passes to it its actual
render
method to add a component to
addChild()
method.
method. That is, Flex only calls the
property or the
explicitHeight
method.
measure()
method to specify the default size:
method
invalidateSize()
event after a call to the
measure()
property of the
method only if
measure()

Advertisement

Table of Contents
loading

Table of Contents