Package | km.display |
Class | public class TextShape |
Inheritance | TextShape ![]() |
import km.display.*; import flash.text.*; var ts:TextShape = new TextShape(); addChild(ts); var tf:TextFormat = new TextFormat('_sans', 12); tf.align = TextFormatAlign.JUSTIFY; ts.defaultTextFormat = tf; ts.text = 'This is a text that will be placed inside the defined containers.'; ts.addContainer(TextShape.MULTI_POINT, [0, 0], [420, 0], [560, 70, 500, 140], [500, 210, 420, 280], [0, 280], [140, 210, 80, 140], [80, 70, 0, 0]); ts.addContainer(TextShape.RECTANGLE, 80, 300, 450, 80); ts.background = true; ts.x = 10; ts.y = 10; ts.render();
Property | Defined by | ||
---|---|---|---|
background : Boolean | TextShape | ||
backgroundColor : uint | TextShape | ||
defaultTextFormat : TextFormat | TextShape | ||
embedFonts : Boolean | TextShape | ||
htmlText : String Sets a html text.
Supported html tags are <b></b> , <br>, <font color = '#000000'></font>, <i></i>, <p align = 'justify'></p>, <u></u> . Changing font size using the font tag is supported but the line height for a rendered text is fixed and defined by the height of the first line of the text. | TextShape | ||
text : String | TextShape | ||
textColor : uint | TextShape | ||
textMargin : int = 2 Horizontal margin between a container and the text inside.
| TextShape |
Method | Defined by | ||
---|---|---|---|
TextShape | |||
addContainer(type:int, ... args):void
Adds a text container.
| TextShape | ||
removeAll():void
Removes all text containers.
| TextShape | ||
render():void
Renders the text.
| TextShape |
Constant | Defined by | ||
---|---|---|---|
ELLIPSE : int = 1 [static]
| TextShape | ||
MULTI_POINT : int = 2 [static]
| TextShape | ||
OBJECT : int = 3 [static]
| TextShape | ||
RECTANGLE : int = 0 [static]
| TextShape |
background | property |
background:Boolean
[read-write]Implementation
public function get background():Boolean
public function set background(value:Boolean):void
backgroundColor | property |
backgroundColor:uint
[read-write]Implementation
public function get backgroundColor():uint
public function set backgroundColor(value:uint):void
defaultTextFormat | property |
defaultTextFormat:TextFormat
[read-write]Implementation
public function get defaultTextFormat():TextFormat
public function set defaultTextFormat(value:TextFormat):void
embedFonts | property |
embedFonts:Boolean
[read-write]Implementation
public function get embedFonts():Boolean
public function set embedFonts(value:Boolean):void
htmlText | property |
htmlText:String
[read-write] Sets a html text.
Supported html tags are <b></b> , <br>, <font color = '#000000'></font>, <i></i>, <p align = 'justify'></p>, <u></u> .
Changing font size using the font tag is supported but the line height for a rendered text is fixed and defined by the height of the first line of the text.
This means if you use multiple font sizes, the first line should be the line with the largest line height.
public function get htmlText():String
public function set htmlText(value:String):void
text | property |
text:String
[read-write]Implementation
public function get text():String
public function set text(value:String):void
textColor | property |
textColor:uint
[read-write]Implementation
public function get textColor():uint
public function set textColor(value:uint):void
textMargin | property |
public var textMargin:int = 2
Horizontal margin between a container and the text inside.
TextShape | () | constructor |
public function TextShape()
addContainer | () | method |
public function addContainer(type:int, ... args):void
Adds a text container.
Parameterstype:int — the container type ( TextShape.RECTANGLE, TextShape.ELLIPSE or TextShape.MULTI_POINT ).
|
|
... args — the arguments required for the selected container type.
In case of an OBJECT container, the object will be removed from where it was on the display list if it was on that list. |
removeAll | () | method |
public function removeAll():void
Removes all text containers.
render | () | method |
public function render():void
Renders the text.
ELLIPSE | constant |
public static const ELLIPSE:int = 1
MULTI_POINT | constant |
public static const MULTI_POINT:int = 2
OBJECT | constant |
public static const OBJECT:int = 3
RECTANGLE | constant |
public static const RECTANGLE:int = 0