| Package | net.flashpunk.graphics |
| Class | public class Text |
| Inheritance | Text Image Graphic Object |
| Property | Defined By | ||
|---|---|---|---|
![]() | active : Boolean = false
If the graphic should update. | Graphic | |
| align : String = left [static]
The alignment to assign to new Text objects. | Text | ||
![]() | alpha : Number
Change the opacity of the Image, a value from 0 to 1. | Image | |
![]() | angle : Number = 0
Rotation of the image, in degrees. | Image | |
![]() | blend : String
Optional blend mode to use when drawing this image. | Image | |
![]() | clipRect : Rectangle [read-only]
Clipping rectangle for the image. | Image | |
![]() | color : uint
The tinted color of the Image. | Image | |
| defaultLeading : Number = 0 [static]
The leading to assign to new Text objects. | Text | ||
![]() | drawMask : BitmapData
Set the transparency mask of the Image. | Image | |
![]() | flipped : Boolean
If you want to draw the Image horizontally flipped. | Image | |
| font : String = default [static]
The font to assign to new Text objects. | Text | ||
| height : uint [override]
Height of the text image. | Text | ||
| leading : Number
Leading (amount of vertical space between lines). | Text | ||
![]() | locked : Boolean [read-only]
True if the image is locked. | Image | |
![]() | originX : Number = 0
X origin of the image, determines transformation point. | Image | |
![]() | originY : Number = 0
Y origin of the image, determines transformation point. | Image | |
![]() | relative : Boolean = true
If the graphic should render at its position relative to its parent Entity's position. | Graphic | |
| resizable : Boolean
If the text field can automatically resize if its contents grow. | Text | ||
| resizable : Boolean = true [static]
The resizable property to assign to new Text objects. | Text | ||
| richText : String
Rich-text string with markup. | Text | ||
![]() | scale : Number = 1
Scale of the image, affects both x and y scale. | Image | |
| scaledHeight : Number [override]
The scaled height of the text. | Text | ||
| scaledWidth : Number [override]
The scaled width of the text. | Text | ||
![]() | scaleX : Number = 1
X scale of the image. | Image | |
![]() | scaleY : Number = 1
Y scale of the image. | Image | |
![]() | scrollX : Number = 1
X scrollfactor, effects how much the camera offsets the drawn graphic. | Graphic | |
![]() | scrollY : Number = 1
Y scrollfactor, effects how much the camera offsets the drawn graphic. | Graphic | |
| size : uint = 16 [static]
The font size to assign to new Text objects. | Text | ||
![]() | smooth : Boolean
If the image should be drawn transformed with pixel smoothing. | Image | |
| text : String
Text string. | Text | ||
| textHeight : uint [read-only]
Height of the text within the image. | Text | ||
| textWidth : uint [read-only]
Width of the text within the image. | Text | ||
![]() | tinting : Number
The amount the image will be tinted, suggested values from
0 to 1. | Image | |
![]() | tintMode : Number
The tint mode - multiply or colorize. | Image | |
![]() | visible : Boolean = true
If the graphic should render. | Graphic | |
| width : uint [override]
Width of the text image. | Text | ||
| wordWrap : Boolean = false [static]
The wordWrap property to assign to new Text objects. | Text | ||
![]() | x : Number = 0
X offset. | Graphic | |
![]() | y : Number = 0
Y offset. | Graphic | |
| Property | Defined By | ||
|---|---|---|---|
| _align : String | Text | ||
![]() | _alpha : Number = 1 | Image | |
![]() | assign : Function | Graphic | |
![]() | _class : String | Image | |
![]() | _color : uint = 0x00FFFFFF | Image | |
![]() | _colorTransform : ColorTransform | Image | |
![]() | _drawMask : BitmapData | Image | |
| _field : TextField | Text | ||
![]() | _flip : BitmapData | Image | |
![]() | _flipped : Boolean | Image | |
![]() | _flips : Object [static] | Image | |
| _font : String | Text | ||
| _form : TextFormat | Text | ||
| _height : uint | Text | ||
| _leading : Number | Text | ||
![]() | _matrix : Matrix | Image | |
| _richText : String | Text | ||
| _size : uint | Text | ||
![]() | source : BitmapData [read-only] | Image | |
| _styles : Object | Text | ||
| _text : String | Text | ||
| _textHeight : uint | Text | ||
| _textWidth : uint | Text | ||
![]() | _tint : ColorTransform | Image | |
![]() | _tintFactor : Number = 1.0 | Image | |
![]() | _tintMode : Number = 0.0 | Image | |
| _width : uint | Text | ||
| _wordWrap : Boolean | Text | ||
| Method | Defined By | ||
|---|---|---|---|
Text(text:String, x:Number = 0, y:Number = 0, options:Object = null, h:Number = 0)
Constructor. | Text | ||
![]() | centerOO():void
Centers the Image's originX/Y to its center. | Image | |
![]() | centerOrigin():void
Centers the Image's originX/Y to its center. | Image | |
![]() | clear():void
Clears the image buffer. | Image | |
![]() | createCircle(radius:uint, color:uint = 0xFFFFFF, alpha:Number = 1):Image [static]
Creates a new circle Image. | Image | |
![]() | createGradient(width:uint, height:uint, fromX:Number, fromY:Number, toX:Number, toY:Number, fromColor:uint, toColor:uint, fromAlpha:Number = 1, toAlpha:Number = 1):Image [static]
Creates a new gradient Image. | Image | |
![]() | createRect(width:uint, height:uint, color:uint = 0xFFFFFF, alpha:Number = 1):Image [static]
Creates a new rectangle Image. | Image | |
getTextProperty(name:String):*
Get TextField or TextForm property
| Text | ||
![]() | lock():void
Lock the image, preventing updateBuffer() from being run until
unlock() is called, for performance. | Image | |
![]() | render(target:BitmapData, point:Point, camera:Point):void
Renders the graphic to the screen buffer. | Graphic | |
setStyle(tagName:String, params:*):void
Set the style for a subset of the text, for use with
the richText property. | Text | ||
setTextProperty(name:String, value:*):Boolean
Set TextField or TextFormat property
returns true on success and false if property not found on either
| Text | ||
![]() | unlock():void
Unlock the image. | Image | |
![]() | update():void
Updates the graphic. | Graphic | |
![]() | updateBuffer(clearBefore:Boolean = false):void
Updates the image buffer. | Image | |
updateTextBuffer():void Updates the text buffer, which is the source for the image buffer. | Text | ||
| Method | Defined By | ||
|---|---|---|---|
updateColorTransform():void [override] | Text | ||
| _align | property |
protected var _align:String
| _field | property |
protected var _field:TextField
| _font | property |
protected var _font:String
| _form | property |
protected var _form:TextFormat
| _height | property |
protected var _height:uint
| _leading | property |
protected var _leading:Number
| _richText | property |
protected var _richText:String
| _size | property |
protected var _size:uint
| _styles | property |
protected var _styles:Object| _text | property |
protected var _text:String
| _textHeight | property |
protected var _textHeight:uint
| _textWidth | property |
protected var _textWidth:uint
| _width | property |
protected var _width:uint
| _wordWrap | property |
protected var _wordWrap:Boolean
| align | property |
align:String = leftThe alignment to assign to new Text objects.
public static function get align():String public static function set align(value:String):void| defaultLeading | property |
public static var defaultLeading:Number = 0The leading to assign to new Text objects.
| font | property |
font:String = defaultThe font to assign to new Text objects.
public static function get font():String public static function set font(value:String):void| height | property |
height:uint[override] Height of the text image.
public function get height():uint public function set height(value:uint):void| leading | property |
leading:NumberLeading (amount of vertical space between lines).
public function get leading():Number public function set leading(value:Number):void| resizable | property |
public var resizable:BooleanIf the text field can automatically resize if its contents grow.
| resizable | property |
public static var resizable:Boolean = trueThe resizable property to assign to new Text objects.
| richText | property |
richText:StringRich-text string with markup. Use setStyle() to control the appearance of marked-up text.
public function get richText():String public function set richText(value:String):void| scaledHeight | property |
scaledHeight:Number[override] The scaled height of the text.
public function get scaledHeight():Number public function set scaledHeight(value:Number):void| scaledWidth | property |
scaledWidth:Number[override] The scaled width of the text.
public function get scaledWidth():Number public function set scaledWidth(value:Number):void| size | property |
size:uint = 16The font size to assign to new Text objects.
public static function get size():uint public static function set size(value:uint):void| text | property |
text:StringText string.
public function get text():String public function set text(value:String):void| textHeight | property |
textHeight:uint [read-only] Height of the text within the image.
public function get textHeight():uint| textWidth | property |
textWidth:uint [read-only] Width of the text within the image.
public function get textWidth():uint| width | property |
width:uint[override] Width of the text image.
public function get width():uint public function set width(value:uint):void| wordWrap | property |
wordWrap:Boolean = falseThe wordWrap property to assign to new Text objects.
public static function get wordWrap():Boolean public static function set wordWrap(value:Boolean):void| Text | () | Constructor |
public function Text(text:String, x:Number = 0, y:Number = 0, options:Object = null, h:Number = 0)Constructor.
Parameterstext:String — Text to display.
| |
x:Number (default = 0) — X offset.
| |
y:Number (default = 0) — Y offset.
| |
options:Object (default = null) — An object containing key/value pairs of the following optional parameters:
font Font family.
size Font size.
align Alignment ("left", "center" or "right").
wordWrap Automatic word wrapping.
resizable If the text field can automatically resize if its contents grow.
width Initial buffer width.
height Initial buffer height.
color Text color.
alpha Text alpha.
angle Rotation angle (see Image.angle).
blend Blend mode (see Image.blend).
visible Visibility (see Graphic.visible).
scrollX See Graphic.scrollX.
scrollY See Graphic.scrollY.
relative See Graphic.relative.
For backwards compatibility, if options is a Number, it will determine the initial buffer width.
| |
h:Number (default = 0) — Deprecated. For backwards compatibility: if set and there is no options.height parameter set, will determine the initial buffer height.
|
| getTextProperty | () | method |
public function getTextProperty(name:String):*Get TextField or TextForm property
Parameters
name:String |
* |
| setStyle | () | method |
public function setStyle(tagName:String, params:*):voidSet the style for a subset of the text, for use with the richText property. Usage: text.setStyle("red", {color: 0xFF0000}); text.setStyle("big", {size: text.size}); text.richText = " ";
Parameters
tagName:String | |
params:* |
| setTextProperty | () | method |
public function setTextProperty(name:String, value:*):BooleanSet TextField or TextFormat property returns true on success and false if property not found on either
Parameters
name:String | |
value:* |
Boolean |
| updateColorTransform | () | method |
override protected function updateColorTransform():void| updateTextBuffer | () | method |
public function updateTextBuffer():voidUpdates the text buffer, which is the source for the image buffer.