Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 163

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

Advertisement

Component users can also override the default size settings in an application by using the
component in the following ways:
Setting the
explicitHeight
Setting the
width
Setting the
percentHeight
For example, you can define a
50 pixels tall, and a default minimum size of 50 pixels by 25 pixels, as the following example
shows:
package myComponents
{
// asAdvanced/myComponents/DeleteTextArea.as
import mx.controls.Button;
public class BlueButton extends Button {
public function BlueButton() {
super();
}
override protected function measure():void {
super.measure();
measuredWidth=100;
measuredMinWidth=50;
measuredHeight=50;
measuredMinHeight=25;
}
}
}
The following application uses this button in an application:
<?xml version="1.0"?>
<!-- asAdvanced/MainBlueButton.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.*" >
<mx:VBox>
<MyComp:BlueButton/>
<mx:Button/>
</mx:VBox>
</mx:Application>
In the absence of any other sizing constraints on the button, the
default size and default minimum size of the button to calculate its size at run time. For
information on the rules for sizing a component, see Chapter 13, "Introducing Containers,"
in Flex 2 Developer's Guide.
and
exlicitWidth
and
properties
height
and
percentWidth
Button
control with a default size of 100 pixels wide and
properties
properties
VBox
container uses the
Implementing the component
163

Advertisement

Table of Contents
loading

Table of Contents