| Package | qnx.fuse.ui.buttons |
| Class | public class LabelButton |
| Inheritance | LabelButton Button SkinnableComponent UIComponent flash.display.MovieClip |
| Subclasses | BackButton, CheckBox, RadioButton |
LabelButton class allows you to add a label to your button.
See also
| Property | Defined By | ||
|---|---|---|---|
| embedFonts : Boolean
Gets or sets the embedFonts property of the internal TextField of the LabelButton. | LabelButton | ||
![]() | explicitHeight : Number [read-only] | UIComponent | |
![]() | explicitWidth : Number [read-only] | UIComponent | |
![]() | includeInLayout : Boolean
Specifies if the component should be included in it's parent containers layout. | UIComponent | |
| label : String
Gets or sets the label for the button. | LabelButton | ||
![]() | layoutData : Object
Returns the layout data for the object. | UIComponent | |
![]() | minHeight : Number
Sets the minimum preferred height of the control. | UIComponent | |
![]() | minWidth : Number
Sets the minimum preferred width of the control. | UIComponent | |
| paddingBottom : uint
Sets the number of extra pixels that are added on the bottom, between the text and the border of the button. | LabelButton | ||
| paddingLeft : uint
Sets the number of extra pixels that are added on the left, between the border of the button and the text. | LabelButton | ||
| paddingRight : uint
Sets the number of extra pixels that are added on the right, between the text and the border of the button. | LabelButton | ||
| paddingTop : uint
Sets the number of extra pixels that are added on the top, between the border of the button and the text. | LabelButton | ||
![]() | selected : Boolean
Gets or sets the selected property of the button. | Button | |
![]() | state : String
Gets or sets the state of the component. | SkinnableComponent | |
![]() | toggle : Boolean
Gets or sets the toggle property of the button. | Button | |
| truncationMode : String
Gets or sets the truncationMode of the button. | LabelButton | ||
| Method | Defined By | ||
|---|---|---|---|
Creates a new LabelButton instance. | LabelButton | ||
![]() | childChanged(resizedChild:DisplayObject = null):Boolean
Notifies the UIComponent that one or more of its children has changed in a manner
that may affect this object's layout. | UIComponent | |
![]() | destroy():void
Call this method when you want to have your object collected by the garbage collector. | UIComponent | |
![]() | getSizeOptions():int | UIComponent | |
getTextFormatForState(state:String):TextFormat
Returns the TextFormat object for a specified state. | LabelButton | ||
![]() | invalidateDisplayList():void
Calling this method results in a call to the components validateDisplayList() method before the display list is rendered. | UIComponent | |
![]() | invalidateProperties():void
Calling this method results in a call to the components validateProperties() method before the display list is rendered. | UIComponent | |
![]() | measure(availableWidth:Number, availableHeight:Number):LayoutMeasurement | UIComponent | |
![]() | setActualSize(w:Number, h:Number):void
Sets the width and height of the object without setting
the explicitWidth and explicitHeight. | UIComponent | |
![]() | setLayoutBounds(bounds:Rectangle):void
Sets the receiver's size and location to the rectangular area specified
by the arguments. | UIComponent | |
![]() | setPosition(x:Number, y:Number):void
Sets the x and y position of the component. | UIComponent | |
![]() | setSkin(newSkin:Object):void
Set the skin object on the component for it to render. | SkinnableComponent | |
setTextFormatForState(format:TextFormat, stateToModify:String):void
Sets the TextFormat object for the label for a given state. | LabelButton | ||
![]() | validateDisplayList():void
Validates the display list of the component by calling the updateDisplayList(). | UIComponent | |
![]() | validateNow():void
Validates the component immediately by calling validateProperties(), validateSizes(), and validateDisplayList() if necessary. | UIComponent | |
![]() | validateProperties():void
Validates the properties of the component by calling the commitProperties() method. | UIComponent | |
| embedFonts | property |
embedFonts:Boolean
Gets or sets the embedFonts property of the internal TextField of the LabelButton.
When set to false, fonts are rendered as device fonts.
When set to true, you must specify a font using the font property of a TextFormat object and
set it using the setTextFormatForState() method.
This font must be included in your application. If it is not included, the text will not be rendererd.
The default value is false.
public function get embedFonts():Boolean public function set embedFonts(value:Boolean):voidSee also
| label | property |
label:StringGets or sets the label for the button.
public function get label():String public function set label(value:String):void| paddingBottom | property |
paddingBottom:uintSets the number of extra pixels that are added on the bottom, between the text and the border of the button.
This affects the preferred size of the button and may be overridden by the layout.
The default value is 0.
public function get paddingBottom():uint public function set paddingBottom(value:uint):void| paddingLeft | property |
paddingLeft:uintSets the number of extra pixels that are added on the left, between the border of the button and the text.
This affects the preferred size of the button and may be overridden by the layout.
The default value is 6.
public function get paddingLeft():uint public function set paddingLeft(value:uint):void| paddingRight | property |
paddingRight:uintSets the number of extra pixels that are added on the right, between the text and the border of the button.
This affects the preferred size of the button and may be overridden by the layout.
The default value is 6.
public function get paddingRight():uint public function set paddingRight(value:uint):void| paddingTop | property |
paddingTop:uintSets the number of extra pixels that are added on the top, between the border of the button and the text. This affects the preferred size of the button and may be overridden by the layout.
The default value is 0.
public function get paddingTop():uint public function set paddingTop(value:uint):void| truncationMode | property |
truncationMode:String
Gets or sets the truncationMode of the button. The truncationMode value defines how the
text label on the button will be treated when the label is too large to appear within the dimensions of the button. The label
can be clipped, or truncated.
Valid values can be found in the TextTruncationMode class.
The default value is qnx.fuse.ui.text.TextTruncationMode.TRUNCATE_TAIL.
public function get truncationMode():String public function set truncationMode(value:String):voidSee also
| LabelButton | () | Constructor |
public function LabelButton()
Creates a new LabelButton instance.
| getTextFormatForState | () | method |
public function getTextFormatForState(state:String):TextFormat
Returns the TextFormat object for a specified state.
Parameters
state:String — The state for the TextFormat object to return. Valid states
are:
|
TextFormat — The TextFormat object for the specified state.
|
See also
| setTextFormatForState | () | method |
public function setTextFormatForState(format:TextFormat, stateToModify:String):void
Sets the TextFormat object for the label for a given state. Valid states
are:
SkinStates.UPSkinStates.DOWNSkinStates.SELECTEDSkinStates.DISABLEDParameters
format:TextFormat — The TextFormat to set.
| |
stateToModify:String — The state for which to change the TextFormat.
|
See also
The following code listing describes how to modify the appearance of your button text for a given state. You can set separate text format objects for each button state. This enables your button text to change color, position, size, or font face whenever a user clicks a button, when a button is disabled, etc.
In this short example,
two text format objects are created and associated with button states. The text format object formatDown is created and associated with the
button.down state using the setTextFormatForState method. The formatDown object specifies the button label text as
white.
package
{
import flash.display.Sprite;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
import qnx.fuse.ui.buttons.LabelButton;
import qnx.fuse.ui.skins.SkinStates;
public class SkinSample extends Sprite
{
public function SkinSample()
{
// create a text format for up, disabled, selected, etc.
// black label text
var format:TextFormat = new TextFormat();
format.font = "Myriad Pro";
format.size = 21;
format.color = 0x000000;
format.align = TextFormatAlign.CENTER;
// create a text format for the down state
// white label text
var formatDown:TextFormat = new TextFormat();
formatDown.font = "BBAlpha Sans";
format.size = 16;
formatDown.color = 0xFFFFFF;
formatDown.align = TextFormatAlign.CENTER;
var _button:LabelButton = new LabelButton();
// set the formats for each state you want to address
_button.setTextFormatForState(format,SkinStates.DISABLED);
_button.setTextFormatForState(format,SkinStates.UP);
_button.setTextFormatForState(formatDown,SkinStates.DOWN);
_button.setTextFormatForState(format,SkinStates.SELECTED);
_button.setTextFormatForState(format,SkinStates.DISABLED_SELECTED);
_button.label = "OK";
_button.x = _button.y = 175;
addChild(_button);
}
}
}