You can set the following properties in the
properties, but you can override them in the
•
_measuredMinWidth
•
_measuredMaxWidth
•
_measuredMinHeight
•
_measuredMaxHeight
•
_measuredPreferredWidth
•
_measuredPreferredHeight
The properties define limits for when the object is resized. These measured properties are used for
layout in containers if your component doesn't explicitly set a
attribute.
preferredHeight
Controls calculate the values of these based on runtime properties. For example, the Button
control's
method examines how wide its label is in order to compute the value of the
measure()
_measuredPreferredWidth
Note: Although you can let Flex determine these values for you, your application startup time will
decrease if you set them yourself.
By default, Flex sets the values of _
to the values of the current height and width, but you should override them. The following
example of the
measure()
the label text field is empty:
function measure(Void):Void {
var myTF = _getTextFormat();
var txt = text;
if (txt == undefined || txt.length < 2) {
txt = "Wj";
}
var textExt = myTF.getTextExtent2(txt);
var textW = textExt.width + 4;
var textH = textExt.height + 4;
if (textW == undefined) {
textW = 20;
}
if (textH == undefined) {
textH = 8;
}
trace("Label:
" + textW + " " + textH);
_measuredPreferredWidth = textW;
_measuredPreferredHeight = textH;
}
measure()
measure()
property.
measuredPreferredWidth
method from the Label component sets a default width and height if
method. Flex calculates the values of these
method:
preferredWidth
and _
measuredPreferredHeight
Writing the component's ActionScript code
or
11