Packageqnx.ui.text
Classpublic class Label
InheritanceLabel Inheritance UIComponent Inheritance flash.display.MovieClip

The Label class displays formatted text. The Label class cannot recieve focus and cannot be used for input.

See also

TextInput


Public Properties
 PropertyDefined By
  autoSize : String
Gets or sets a String that indicates how a label is sized and aligned to fit the value of its text property.
Label
 Inheritedcontainment : String
Gets or sets a property that determines how a component is contained within a parent container.
UIComponent
  embedFonts : Boolean
Gets or sets the embedFonts property of the internal TextField of the label.
Label
  format : TextFormat
Gets or sets the TextFormat object of the label.
Label
  htmlText : String
Gets or sets the html text of the label
Label
  multiline : Boolean
Gets or sets a Boolean that determines whether or not the TextField supports multiline display.
Label
  selectable : Boolean
Gets or sets a Boolean that determines whether or not the text can be selected.
Label
 Inheritedsize : Number
Gets or sets the size for this component (as a percentage of the container's size, or in pixels).
UIComponent
 InheritedsizeMode : String
Gets or sets the size mode for this component.
UIComponent
 InheritedsizeUnit : String
Gets or sets the unit of measure for the size property.
UIComponent
  text : String
Gets or sets the text of the label.
Label
  textField : TextField
[read-only] Gets a reference to the internal textField of the label.
Label
  textHeight : int
[read-only] Returns the height of the label text (in pixels).
Label
  textWidth : int
[read-only] Returns the width of the label text (in pixels).
Label
  wordWrap : Boolean
Gets or sets a Boolean that determines whether or not the label supports word wrapping.
Label
Public Methods
 MethodDefined By
  
Creates a new Label instance.
Label
 Inherited
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
 Inherited
drawNow():void
Calls the draw() method.
UIComponent
 Inherited
invalidate(property:String, invalidateNow:Boolean = false):void
Marks the property as invalid and the draw() method is called on the next frame or the next render, whichever comes first.
UIComponent
 Inherited
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
  
setSize(w:Number, h:Number):void
[override] Sets the width and height of the component.
Label
Protected Methods
 MethodDefined By
 Inherited
callLater(method:Function):void
Calls the specified method on the next frame or the next render, which ever happens first.
UIComponent
 Inherited
createInstance(linkage:Object):DisplayObject
Calling this method will attempt to create a DisplayObject instance based on the value of the linkage parameter.
UIComponent
 Inherited
draw():void
Called every time you set the width and height of the component.
UIComponent
 Inherited
isInvalid(property:String, ... properties):Boolean
Checks to see if the property is invalid and returns true if it is.
UIComponent
 Inherited
onAdded():void
Called when the instance is added to the stage.
UIComponent
 Inherited
onRemoved():void
Called when the instance is removed from the stage.
UIComponent
 Inherited
setEnabled(val:Boolean):void
Called when the enabled property changes.
UIComponent
 Inherited
validate(property:String):void
Lets the component know that the specified property has been validated.
UIComponent
Property Detail
autoSizeproperty
autoSize:String

Gets or sets a String that indicates how a label is sized and aligned to fit the value of its text property.

The following are valid values:

The default value is The default value is TextFieldAutoSize.NONE.


Implementation
    public function get autoSize():String
    public function set autoSize(value:String):void
embedFontsproperty 
embedFonts:Boolean

Gets or sets the embedFonts property of the internal TextField of the label. 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 to the format property. This font must be included in the in your application. If it is not included, the text will not be rendererd.

The default value is false.


Implementation
    public function get embedFonts():Boolean
    public function set embedFonts(value:Boolean):void
formatproperty 
format:TextFormat

Gets or sets the TextFormat object of the label.

The TextFormat object is used to format and style the text of the label. The label has the following default text format:

The following listing creates a TextFormat object and applies it to a Label instance:

        var labelFormat:TextFormat = new TextFormat();
        labelFormat.size = 22;
        
        firstLabel = new Label();
        firstLabel.format = labelFormat;
        firstLabel.text = "First label";
        


Implementation
    public function get format():TextFormat
    public function set format(value:TextFormat):void
htmlTextproperty 
htmlText:String

Gets or sets the html text of the label


Implementation
    public function get htmlText():String
    public function set htmlText(value:String):void
multilineproperty 
multiline:Boolean

Gets or sets a Boolean that determines whether or not the TextField supports multiline display.


Implementation
    public function get multiline():Boolean
    public function set multiline(value:Boolean):void
selectableproperty 
selectable:Boolean

Gets or sets a Boolean that determines whether or not the text can be selected.


Implementation
    public function get selectable():Boolean
    public function set selectable(value:Boolean):void
textproperty 
text:String

Gets or sets the text of the label.


Implementation
    public function get text():String
    public function set text(value:String):void
textFieldproperty 
textField:TextField  [read-only]

Gets a reference to the internal textField of the label.


Implementation
    public function get textField():TextField
textHeightproperty 
textHeight:int  [read-only]

Returns the height of the label text (in pixels).


Implementation
    public function get textHeight():int
textWidthproperty 
textWidth:int  [read-only]

Returns the width of the label text (in pixels).


Implementation
    public function get textWidth():int
wordWrapproperty 
wordWrap:Boolean

Gets or sets a Boolean that determines whether or not the label supports word wrapping.


Implementation
    public function get wordWrap():Boolean
    public function set wordWrap(value:Boolean):void
Constructor Detail
Label()Constructor
public function Label()

Creates a new Label instance.

Method Detail
setSize()method
override public function setSize(w:Number, h:Number):void

Sets the width and height of the component.

After setting the new dimensions, the setSize() function calls the draw() method, which allows you to adjust the layout or redraw your component's children.

Parameters

w:Number — The new width of the component.
 
h:Number — The new height of the component.