Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 164

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

Advertisement

You can override the default size settings in an application, as the following example shows:
<?xml version="1.0"?>
<!-- asAdvanced/MainBlueButtonResize.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.*" >
<mx:VBox>
<MyComp:BlueButton width="50%"/>
<mx:Button/>
</mx:VBox>
</mx:Application>
In this example, you specify that the width of the button is 50% of the width of the VBox
container. When 50% of the width if the container is smaller than the minimum width of the
button, the button uses its minimum width.
Calculating default sizes
The example in
"Implementing the measure() method" on page 162
default size and default minimum size of a component. Some Flex components use static sizes.
For example, the
TextArea
regardless of the text it contains. If the text is larger than the TextArea control, the control
displays scroll bars.
Often, you set the default size based on characteristics of the component or information
passed to the component. For example, the
label text, margin settings, and font characteristics to determine the control's default size.
164
Creating Advanced Visual Components in ActionScript
control has a default size of 100 pixels wide by 44 pixels high,
Button
uses static values for the
control's
measure()
method examines its

Advertisement

Table of Contents
loading

Table of Contents