class Label
package feathers.controls
extends FeathersControl › MeasureSprite › ValidatingSprite
implements IStageFocusDelegate, IFocusObject, IHTMLTextControl, ITextControl
Displays text with an optional background.
The following example creates a label and gives it text:
var label = new Label();
label.text = "Hello World";
this.addChild(label);
1.0.0
.See also:
Static variables
staticfinalread onlyVARIANT_DANGER:String = "danger"
A variant used to style the label using an appearance that indicates an error or warning.
The following example uses this variant:
var label = new Label();
label.variant = Label.VARIANT_DANGER;
1.1.0
.See also:
staticfinalread onlyVARIANT_DETAIL:String = "detail"
A variant used to style the label using a smaller text format for details. Variants allow themes to provide an assortment of different appearances for the same type of UI component.
The following example uses this variant:
var label = new Label();
label.variant = Label.VARIANT_DETAIL;
1.0.0
.See also:
staticfinalread onlyVARIANT_HEADING:String = "heading"
A variant used to style the label using a Larger text format for headings. Variants allow themes to provide an assortment of different appearances for the same type of UI component.
The following example uses this variant:
var label = new Label();
label.variant = Label.VARIANT_HEADING;
1.0.0
.See also:
Constructor
Variables
backgroundSkin:DisplayObject
The default background skin to display behind the label's text.
The following example passes a bitmap for the label to use as a background skin:
label.backgroundSkin = new Bitmap(bitmapData);
1.0.0
.See also:
disabledBackgroundSkin:DisplayObject
A background skin to display behind the label's text when the label is disabled.
The following example gives the label a disabled background skin:
label.disabledBackgroundSkin = new Bitmap(bitmapData);
label.enabled = false;
1.0.0
.See also:
disabledTextFormat:AbstractTextFormat
The font styles used to render the label's text when the label is disabled.
In the following example, the label's disabled text formatting is customized:
label.enabled = false;
label.disabledTextFormat = new TextFormat("Helvetica", 20, 0xee0000);
1.0.0
.See also:
embedFonts:Bool
Determines if an embedded font is used or not.
In the following example, the label uses embedded fonts:
label.embedFonts = true;
1.0.0
.See also:
htmlText:String
Text displayed by the label that is parsed as a simple form of HTML.
The following example sets the label's HTML text:
label.htmlText = "<b>Hello</b> <i>World</i>";
1.0.0
.See also:
paddingBottom:Float
The minimum space, in pixels, between the label's bottom edge and the label's content.
In the following example, the label's bottom padding is set to 20 pixels:
label.paddingBottom = 20.0;
1.0.0
.paddingLeft:Float
The minimum space, in pixels, between the label's left edge and the label's content.
In the following example, the label's left padding is set to 20 pixels:
label.paddingLeft = 20.0;
1.0.0
.paddingRight:Float
The minimum space, in pixels, between the label's right edge and the label's content.
In the following example, the label's right padding is set to 20 pixels:
label.paddingRight = 20.0;
1.0.0
.paddingTop:Float
The minimum space, in pixels, between the label's top edge and the label's content.
In the following example, the label's top padding is set to 20 pixels:
label.paddingTop = 20.0;
1.0.0
.selectable:Bool
Indicates if the label's text may be selected or not.
In the following example, the label text is selectable:
label.selectable = true;
1.0.0
.read onlyselectionBeginIndex:Int
The start index of the selection.
If selectable
is false
, returns -1
.
1.0.0
.read onlyselectionEndIndex:Int
The end index of the selection.
If selectable
is false
, returns -1
.
1.0.0
.text:String
The text displayed by the label.
The following example sets the label's text:
label.text = "Good afternoon!";
Note: If the htmlText
property is not null
, the text
property will
be ignored.
1.0.0
.See also:
textFormat:AbstractTextFormat
The font styles used to render the label's text.
In the following example, the label's text formatting is customized:
label.textFormat = new TextFormat("Helvetica", 20, 0xcc0000);
1.0.0
.See also:
verticalAlign:VerticalAlign
How the content is positioned vertically (along the y-axis) within the label.
The following example aligns the label's content to the top:
label.verticalAlign = TOP;
Note: The VerticalAlign.JUSTIFY
constant is not supported by this
component.
1.0.0
.See also:
wordWrap:Bool
Determines if the text is displayed on a single line, or if it wraps.
In the following example, the label's text wraps at 150 pixels:
label.width = 150.0;
label.wordWrap = true;
1.0.0
.Methods
setPadding(value:Float):Void
Sets all four padding properties to the same value.
1.0.0
.See also: