Package | flashx.textLayout.factory |
Class | public final class StringTextLineFactory |
Inheritance | StringTextLineFactory TextLineFactoryBase Object |
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
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.
See also
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 | ||
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
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 : flashx.textLayout.formats:ITextLayoutFormat
The paragraph format. | StringTextLineFactory | ||
prototype : Object [static]
A reference to the prototype object of a class or function object. | Object | ||
spanFormat : flashx.textLayout.formats: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 : flashx.textLayout.formats:ITextLayoutFormat
The text flow format. | StringTextLineFactory | ||
truncationOptions : flashx.textLayout.factory: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 |
Method | Defined By | ||
---|---|---|---|
StringTextLineFactory(configuration:IConfiguration = null)
Creates a StringTextLineFactory object. | StringTextLineFactory | ||
Creates TextLine objects using the text currently assigned to this factory object. | StringTextLineFactory | ||
The smallest rectangle in which the layed-out content fits. | TextLineFactoryBase | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Returns the primitive value of the specified object. | Object |
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:flashx.textLayout.formats:ITextLayoutFormat
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
The paragraph format.
Implementation
public function get paragraphFormat():flashx.textLayout.formats:ITextLayoutFormat
public function set paragraphFormat(value:flashx.textLayout.formats:ITextLayoutFormat):void
spanFormat | property |
spanFormat:flashx.textLayout.formats:ITextLayoutFormat
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
The character format.
Implementation
public function get spanFormat():flashx.textLayout.formats:ITextLayoutFormat
public function set spanFormat(value:flashx.textLayout.formats: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:flashx.textLayout.formats:ITextLayoutFormat
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
The text flow format.
Implementation
public function get textFlowFormat():flashx.textLayout.formats:ITextLayoutFormat
public function set textFlowFormat(value:flashx.textLayout.formats:ITextLayoutFormat):void
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.
Parametersconfiguration:IConfiguration (default = null ) — The configuration object used to set the properties of the
internal TextFlow object used to compose lines produced by this factory.
|
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.
Parameters
callback:Function — The callback function called for each TextLine object created.
|
createTextLines()
is called twice using the same phrase. The factory properties are adjusted between calls
to create a "drop shadow" effect.
package flashx.textLayout.factory.examples { import flash.display.DisplayObject; import flash.display.Sprite; import flash.geom.Rectangle; import flashx.textLayout.factory.StringTextLineFactory; import flashx.textLayout.formats.TextLayoutFormat; public class StringTextLineFactory_example extends Sprite { public function StringTextLineFactory_example() { var factory:StringTextLineFactory = new StringTextLineFactory(); factory.compositionBounds = new Rectangle( 100, 100, 200, 130 ); var format:TextLayoutFormat = new TextLayoutFormat(); format.fontFamily = "LilyUPC, Verdana, _sans"; format.fontSize = 32; format.color = 0x000000; format.textAlpha = .5; factory.spanFormat = format; factory.text = "The quick brown fox jumped over the lazy dog."; factory.createTextLines( useTextLines ); factory.compositionBounds = new Rectangle( 99, 99, 200, 130 ); format.color = 0x990000; format.textAlpha = 1; factory.spanFormat = format; factory.createTextLines( useTextLines ); graphics.beginFill(0x555555,.5); graphics.drawRect( 99, 99, 201, 131 ); graphics.endFill(); } private function useTextLines( line:DisplayObject ):void { var displayObject:DisplayObject = this.addChild( line ); } } }
Fri Mar 19 2010, 02:45 AM -07:00