Apache Flex 4.16.1 API Reference | All Packages | All Classes | Index | Frames No Frames |
StringTextLineFactory

Package | flashx.textLayout.factory
Class | public class StringTextLineFactory
Inheritance | StringTextLineFactory TextLineFactoryBase Object

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

The StringTextLineFactory class provides a simple way to create TextLines from a string.

The text lines are static and are created using a single format and a single paragraph. The lines are created to fit in the specified bounding rectangle.

The StringTextLineFactory provides an efficient way to create TextLines, since it reuses single TextFlow, ParagraphElement, SpanElement, and ContainerController objects across many repeated invocations. You can create a single factory, and use it again and again. You can also reuse all the parts that are the same each time you call it; for instance, you can reuse the various formats and the bounds.

Note: To create static lines that use multiple formats or paragraphs, or that include inline graphics, use a TextFlowTextLineFactory and a TextFlow object.

Note: The StringTextLineFactory ignores the truncationIndicatorFormat property set in the truncationOptions when truncating text.

See also

TextFlowTextLineFactory

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | compositionBounds : Rectangle The rectangle within which text lines are created. | TextLineFactoryBase
|  | configuration : IConfiguration [read-only] The configuration used by the internal TextFlow object. | StringTextLineFactory
|  | defaultConfiguration : IConfiguration [static] [read-only] The default configuration used by this factory if none is specified. | StringTextLineFactory
|  | horizontalScrollPolicy : String Specifies how lines are created when the composition bounds are not large enough. | TextLineFactoryBase
|  | isTruncated : Boolean [read-only] Indicates whether text was truncated when lines were last created. | TextLineFactoryBase
|  | paragraphFormat : ITextLayoutFormat The paragraph format. | StringTextLineFactory
|  | spanFormat : ITextLayoutFormat The character format. | StringTextLineFactory
|  | swfContext : ISWFContext The ISWFContext instance used to make FTE calls as needed. | TextLineFactoryBase
|  | text : String The text to convert into TextLine objects. | StringTextLineFactory
|  | textFlowFormat : ITextLayoutFormat The text flow format. | StringTextLineFactory
|  | truncationOptions : TruncationOptions Specifies the options for truncating the text if it doesn't fit in the composition bounds. | TextLineFactoryBase
|  | verticalScrollPolicy : String Specifies how lines are created when the composition bounds are not large enough. | TextLineFactoryBase

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | StringTextLineFactory(configuration:IConfiguration = null) Creates a StringTextLineFactory object. | StringTextLineFactory
|  | createTextLines(callback:Function):void Creates TextLine objects using the text currently assigned to this factory object. | StringTextLineFactory
|  | getContentBounds():Rectangle The smallest rectangle in which the layed-out content fits. | TextLineFactoryBase

Property Detail

configuration | property

`configuration:IConfiguration` [read-only]

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

The configuration used by the internal TextFlow object.

Implementation
`public function get configuration():IConfiguration`

defaultConfiguration | property |

`defaultConfiguration:IConfiguration` [read-only]

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

The default configuration used by this factory if none is specified.

Implementation
`public static function get defaultConfiguration():IConfiguration`

paragraphFormat | property |

`paragraphFormat:ITextLayoutFormat`

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

The paragraph format.

Implementation
`public function get paragraphFormat():ITextLayoutFormat`
`public function set paragraphFormat(value:ITextLayoutFormat):void`

spanFormat | property |

`spanFormat:ITextLayoutFormat`

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

The character format.

Implementation
`public function get spanFormat():ITextLayoutFormat`
`public function set spanFormat(value:ITextLayoutFormat):void`

text | property |

`text:String`

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

The text to convert into TextLine objects.

To produce TextLines, call `createTextLines()` after setting this `text` property and the desired formats.

Implementation
`public function get text():String`
`public function set text(value:String):void`

textFlowFormat | property |

`textFlowFormat:ITextLayoutFormat`

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

The text flow format.

Implementation
`public function get textFlowFormat():ITextLayoutFormat`
`public function set textFlowFormat(value:ITextLayoutFormat):void`
Constructor Detail

StringTextLineFactory | () | Constructor

`public function StringTextLineFactory(configuration:IConfiguration = null)`

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

Creates a StringTextLineFactory object.

Parameters

| `configuration:IConfiguration` (default = `null`)`` — The configuration object used to set the properties of the internal TextFlow object used to compose lines produced by this factory.

Method Detail

createTextLines | () | method

`public function createTextLines(callback:Function):void`

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

Creates TextLine objects using the text currently assigned to this factory object.

The text lines are created using the currently assigned text and formats and are composed to fit the bounds assigned to the `compositionBounds` property. As each line is created, the factory calls the function specified in the `callback` parameter. This function is passed the TextLine object and is responsible for displaying the line.

To create a different set of lines, change any properties desired and call `createTextLines()` again.

Note that the scroll policies of the factory will control how many lines are generated.

Parameters

| `callback:Function` — The callback function called for each TextLine object created.

Wed Nov 15 2017, 09:50 AM +01:00