Class Index | File Index

Classes


Class Text


Extends DisplayObject.
Allows you to display one or more lines of dynamic text (not user editable) in the display list. Line wrapping support (using the lineWidth is very basic, wrapping on spaces and tabs only. Note that as an alternative to Text, you can position HTML text above or below the canvas relative to items in the display list using the localToGlobal() method.
Defined in: Text.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Text(text, font, color)
Constructs a new Text instance.
Field Summary
Field Attributes Field Name and Description
 
The color to draw the text in.
 
The font style to use.
 
Indicates the line height (vertical distance between baselines) for multi-line text.
 
Indicates the maximum width for a line of text before it is wrapped to multiple lines.
 
The maximum width to draw the text.
 
If true, the text will be drawn as a stroke (outline).
 
The text to display.
 
The horizontal text alignment.
 
The vertical alignment point on the font.
Fields borrowed from class DisplayObject:
alpha, cacheCanvas, compositeOperation, id, mouseEnabled, name, onClick, onPress, parent, regX, regY, rotation, scaleX, scaleY, shadow, skewX, skewY, snapToPixel, visible, x, y
Method Summary
Method Attributes Method Name and Description
 
Returns an approximate line height of the text, ignoring the lineHeight property.
 
Returns the measured, untransformed width of the text.
Methods borrowed from class DisplayObject:
cache, clone, draw, getConcatenatedMatrix, getStage, globalToLocal, hitTest, isVisible, localToGlobal, localToLocal, toString, uncache, updateCache
Class Detail
Text(text, font, color)
Constructs a new Text instance.
Parameters:
text
Optional. The text to display.
font
Optional. The font style to use. Any valid value for the CSS font attribute is acceptable (ex. "36px bold Arial").
color
Optional. The color to draw the text in. Any valid value for the CSS color attribute is acceptable (ex. "#F00").
Field Detail
color
The color to draw the text in. Any valid value for the CSS color attribute is acceptable (ex. "#F00").

font
The font style to use. Any valid value for the CSS font attribute is acceptable (ex. "bold 36px Arial").

lineHeight
Indicates the line height (vertical distance between baselines) for multi-line text. If null, the value of getMeasuredLineHeight is used.

lineWidth
Indicates the maximum width for a line of text before it is wrapped to multiple lines. If null, the text will not be wrapped.

maxWidth
The maximum width to draw the text. If maxWidth is specified (not null), the text will be condensed or shrunk to make it fit in this width. For detailed information view the whatwg spec.

outline
If true, the text will be drawn as a stroke (outline). If false, the text will be drawn as a fill.

text
The text to display.

textAlign
The horizontal text alignment. Any of start, end, left, right, and center. For detailed information view the whatwg spec.

textBaseline
The vertical alignment point on the font. Any of top, hanging, middle, alphabetic, ideographic, or bottom. For detailed information view the whatwg spec.
Method Detail
getMeasuredLineHeight()
Returns an approximate line height of the text, ignoring the lineHeight property. This is based on the measured width of a "M" character multiplied by 1.2, which approximates em for most fonts.

getMeasuredWidth()
Returns the measured, untransformed width of the text.

Documentation generated by JsDoc Toolkit 2.3.2 on Mon Feb 07 2011 16:51:57 GMT-0700 (MST)