Packageflare.display
Classpublic class TextSprite
InheritanceTextSprite Inheritance DirtySprite Inheritance flash.display.Sprite
SubclassesAxisLabel

A Sprite representing a text label. TextSprites support multiple forms of text representation: bitmapped text, embedded font text, and standard (device font) text. This allows flexibility in how text labels are handled. For example, by default, text fields using device fonts do not support alpha blending or rotation. By using a TextSprite in BITMAP mode, the text is rendered out to a bitmap which can then be alpha blended.



Public Properties
 PropertyDefined by
 Inheritedangle : Number
The angle value of this sprite's position in polar co-ordinates.
DirtySprite
  bitmap : Bitmap
[read-only] The bitmap of the text, if in BITMAP mode.
TextSprite
  bold : Boolean
The boldness of the text.
TextSprite
  color : uint
The color of the text.
TextSprite
  font : String
The font to the text.
TextSprite
 Inheritedheight : Number
If dirty, this sprite is re-rendered before returning the height.
DirtySprite
  horizontalAnchor : int
The horizontal anchor for the text, one of LEFT, RIGHT, or CENTER.
TextSprite
  htmlText : String
The html text shown by this TextSprite.
TextSprite
  italic : Boolean
The italics of the text.
TextSprite
  kerning : Boolean
The kerning of the text.
TextSprite
  letterSpacing : int
The letter-spacing of the text.
TextSprite
 Inheritedorigin : Point
The origin point for polar coordinates.
DirtySprite
 Inheritedradius : Number
The radius value of this sprite's position in polar co-ordinates.
DirtySprite
  size : Number
The size of the text.
TextSprite
  text : String
The text shown by this TextSprite.
TextSprite
  textField : TextField
[read-only] The TextField instance backing this TextSprite.
TextSprite
  textFormat : TextFormat
The default text format for this text sprite.
TextSprite
  textMode : int
The text rendering mode for this TextSprite, one of BITMAP, DEVICE, or EMBED.
TextSprite
  underline : Boolean
The underline of the text.
TextSprite
  verticalAnchor : int
The vertical anchor for the text, one of TOP, BOTTOM, or MIDDLE.
TextSprite
 Inheritedwidth : Number
If dirty, this sprite is re-rendered before returning the width.
DirtySprite
 Inheritedx : Number
DirtySprite
 Inheritedy : Number
DirtySprite
Protected Properties
 PropertyDefined by
 Inherited_angle : Number
The angle value of this sprite's position in polar co-ordinates.
DirtySprite
 Inherited_origin : Point
The origin point for polar coordinates.
DirtySprite
 Inherited_radius : Number
The radius value of this sprite's position in polar co-ordinates.
DirtySprite
Public Methods
 MethodDefined by
  
TextSprite(text:String = null, format:TextFormat = null, mode:int)
Creates a new TextSprite instance.
TextSprite
  
applyFormat(fmt:TextFormat):void
Applies the settings of the input text format to this sprite's internal text format.
TextSprite
 Inherited
dirty():void
Marks this sprite as "dirty" and in need of re-rendering.
DirtySprite
 Inherited
getBounds(targetCoordinateSpace:DisplayObject):Rectangle
If dirty, this sprite is re-rendered returning the bounds.
DirtySprite
 Inherited
getRect(targetCoordinateSpace:DisplayObject):Rectangle
If dirty, this sprite is re-rendered before returning the rect.
DirtySprite
 Inherited
hitTestObject(obj:DisplayObject):Boolean
If dirty, either sprite is re-rendered before hit-testing.
DirtySprite
 Inherited
hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean
If dirty, this sprite is re-rendered before hit-testing.
DirtySprite
  
render():void
Draw this sprite's graphical content.
TextSprite
 Inherited
renderDirty(evt:Event = null):void
[static] Frame render callback that renders all sprites on the dirty list.
DirtySprite
 Inherited
toString():String
DirtySprite
Protected Methods
 MethodDefined by
  
setMode(mode:int):void
TextSprite
Public Constants
 ConstantDefined by
  BITMAP : uint = 2
[static] Constant indicating that text should be rendered into a Bitmap instance.
TextSprite
  BOTTOM : int = 2
[static] Constant for vertically aligning the bottom of the text field to a TextSprite's y-coordinate.
TextSprite
  CENTER : int = 1
[static] Constant for horizontally aligning the center of the text field to a TextSprite's y-coordinate.
TextSprite
  DEVICE : uint = 0
[static] Constant indicating that text should be rendered using a TextField instance using device fonts.
TextSprite
  EMBED : uint = 1
[static] Constant indicating that text should be rendered using a TextField instance using embedded fonts.
TextSprite
  LEFT : int = 0
[static] Constant for horizontally aligning the left of the text field to a TextSprite's y-coordinate.
TextSprite
  MIDDLE : int = 1
[static] Constant for vertically aligning the middle of the text field to a TextSprite's y-coordinate.
TextSprite
  RIGHT : int = 2
[static] Constant for horizontally aligning the right of the text field to a TextSprite's y-coordinate.
TextSprite
  TOP : int = 0
[static] Constant for vertically aligning the top of the text field to a TextSprite's y-coordinate.
TextSprite
 InheritedZERO : Point
[static] A constant for the point (0,0).
DirtySprite
Property detail
bitmapproperty
bitmap:Bitmap  [read-only]

The bitmap of the text, if in BITMAP mode.

Implementation
    public function get bitmap():Bitmap
boldproperty 
bold:Boolean  [read-write]

The boldness of the text.

Implementation
    public function get bold():Boolean
    public function set bold(value:Boolean):void
colorproperty 
color:uint  [read-write]

The color of the text.

Implementation
    public function get color():uint
    public function set color(value:uint):void
fontproperty 
font:String  [read-write]

The font to the text.

Implementation
    public function get font():String
    public function set font(value:String):void
horizontalAnchorproperty 
horizontalAnchor:int  [read-write]

The horizontal anchor for the text, one of LEFT, RIGHT, or CENTER. This setting determines how the text is horizontally aligned with respect to this TextSprite's (x,y) location.

Implementation
    public function get horizontalAnchor():int
    public function set horizontalAnchor(value:int):void
htmlTextproperty 
htmlText:String  [read-write]

The html text shown by this TextSprite.

Implementation
    public function get htmlText():String
    public function set htmlText(value:String):void
italicproperty 
italic:Boolean  [read-write]

The italics of the text.

Implementation
    public function get italic():Boolean
    public function set italic(value:Boolean):void
kerningproperty 
kerning:Boolean  [read-write]

The kerning of the text.

Implementation
    public function get kerning():Boolean
    public function set kerning(value:Boolean):void
letterSpacingproperty 
letterSpacing:int  [read-write]

The letter-spacing of the text.

Implementation
    public function get letterSpacing():int
    public function set letterSpacing(value:int):void
sizeproperty 
size:Number  [read-write]

The size of the text.

Implementation
    public function get size():Number
    public function set size(value:Number):void
textproperty 
text:String  [read-write]

The text shown by this TextSprite.

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

The TextField instance backing this TextSprite.

Implementation
    public function get textField():TextField
textFormatproperty 
textFormat:TextFormat  [read-write]

The default text format for this text sprite.

Implementation
    public function get textFormat():TextFormat
    public function set textFormat(value:TextFormat):void
textModeproperty 
textMode:int  [read-write]

The text rendering mode for this TextSprite, one of BITMAP, DEVICE, or EMBED.

Implementation
    public function get textMode():int
    public function set textMode(value:int):void
underlineproperty 
underline:Boolean  [read-write]

The underline of the text.

Implementation
    public function get underline():Boolean
    public function set underline(value:Boolean):void
verticalAnchorproperty 
verticalAnchor:int  [read-write]

The vertical anchor for the text, one of TOP, BOTTOM, or MIDDLE. This setting determines how the text is vertically aligned with respect to this TextSprite's (x,y) location.

Implementation
    public function get verticalAnchor():int
    public function set verticalAnchor(value:int):void
Constructor detail
TextSprite()constructor
public function TextSprite(text:String = null, format:TextFormat = null, mode:int)

Creates a new TextSprite instance.

Parameters
text:String (default = null) — the text string for this label
 
format:TextFormat (default = null) — the TextFormat determining font family, size, and style
 
mode:int — the text rendering mode to use (BITMAP by default)
Method detail
applyFormat()method
public function applyFormat(fmt:TextFormat):void

Applies the settings of the input text format to this sprite's internal text format. This method makes a shallow copy of the input format, it does not save a reference to it.

Parameters
fmt:TextFormat — the text format to apply
render()method 
public override function render():void

Draw this sprite's graphical content. Subclasses should override this method with custom drawing code.

setMode()method 
protected function setMode(mode:int):voidParameters
mode:int
Constant detail
BITMAPconstant
public static const BITMAP:uint = 2

Constant indicating that text should be rendered into a Bitmap instance.

BOTTOMconstant 
public static const BOTTOM:int = 2

Constant for vertically aligning the bottom of the text field to a TextSprite's y-coordinate.

CENTERconstant 
public static const CENTER:int = 1

Constant for horizontally aligning the center of the text field to a TextSprite's y-coordinate.

DEVICEconstant 
public static const DEVICE:uint = 0

Constant indicating that text should be rendered using a TextField instance using device fonts.

EMBEDconstant 
public static const EMBED:uint = 1

Constant indicating that text should be rendered using a TextField instance using embedded fonts. For this mode to work, the fonts used must be embedded in your application SWF file.

LEFTconstant 
public static const LEFT:int = 0

Constant for horizontally aligning the left of the text field to a TextSprite's y-coordinate.

MIDDLEconstant 
public static const MIDDLE:int = 1

Constant for vertically aligning the middle of the text field to a TextSprite's y-coordinate.

RIGHTconstant 
public static const RIGHT:int = 2

Constant for horizontally aligning the right of the text field to a TextSprite's y-coordinate.

TOPconstant 
public static const TOP:int = 0

Constant for vertically aligning the top of the text field to a TextSprite's y-coordinate.