| Package | flashx.textLayout.factory | 
| Class | public class TextFlowTextLineFactory | 
| Inheritance | TextFlowTextLineFactory  TextLineFactoryBase  Object | 
| Language Version: | ActionScript 3.0 | 
| Runtime Versions: | Flash Player 10, AIR 1.5 | 
The text lines are static and created fit in a single bounding rectangle, but can have multiple paragraphs and formats as well as inline graphics. To create TextLine objects directly from a string, use StringTextLineFactory.
Note: When using inline graphics, the source property of the InlineGraphicElement object 
 must either be an instance of a DisplayObject or a Class object representing an embedded asset. 
 URLRequest objects cannot be used. The width and height of the inline graphic at the time the line 
 is created is used to compose the flow. 
Related API Elements
| Property | Defined By | ||
|---|---|---|---|
|  | compositionBounds : Rectangle 
		 The rectangle within which text lines are created. | TextLineFactoryBase | |
|  | constructor : Object 
	 A reference to the class object or constructor function for a given object instance. | Object | |
|  | 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 | |
|  | swfContext : ISWFContext  
		The ISWFContext instance used to make FTE calls as needed. | TextLineFactoryBase | |
|  | 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 | ||
|---|---|---|---|
|  
		 Creates a TextFlowTextLineFactory object. | TextFlowTextLineFactory | ||
| 
		 Creates TextLine objects from the specified text flow. | TextFlowTextLineFactory | ||
|  | 
		 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 | |
| TextFlowTextLineFactory | () | Constructor | 
public function TextFlowTextLineFactory()| Language Version: | ActionScript 3.0 | 
| Runtime Versions: | Flash Player 10, AIR 1.5 | 
Creates a TextFlowTextLineFactory object.
| createTextLines | () | method | 
 public function createTextLines(callback:Function, textFlow:flashx.textLayout.elements:TextFlow):void| Language Version: | ActionScript 3.0 | 
| Runtime Versions: | Flash Player 10, AIR 1.5 | 
Creates TextLine objects from the specified text flow.
The text lines 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. If a line has a background color, the factory also calls the
		 callback function with a Shape object containing a rectangle of the background color.
Note that the scroll policies of the factory will control how many lines are generated.
Parameters
| callback:Function— function to call with each generated TextLine object.  
		 The callback will be called with a Shape object representing any background color (if present), 
		 and with TextLine objects for the text. | |
| textFlow:flashx.textLayout.elements:TextFlow— The TextFlow from which the lines are created. | 
createTextLines() is called twice using the same phrase. The factory properties and flow formats are 
 adjusted between calls to create a "drop shadow" effect. 
package flashx.textLayout.factory.examples
{
    import flash.display.Sprite;
    import flash.display.DisplayObject;
    import flash.geom.Rectangle;
    import flash.text.engine.TextLine;
    
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    import flashx.textLayout.factory.TextFlowTextLineFactory;
    import flashx.textLayout.formats.TextLayoutFormat;
    public class TextFlowTextLineFactory_example extends Sprite
    {
        public function TextFlowTextLineFactory_example()
        {
            var factory:TextFlowTextLineFactory = new TextFlowTextLineFactory();
            factory.compositionBounds = new Rectangle( 100, 100, 200, 130 );
            
            var flow:TextFlow = new TextFlow();
            var format:TextLayoutFormat = new TextLayoutFormat();
            format.fontFamily = "LilyUPC, Verdana, _sans";
            format.fontSize = 32;
            format.color = 0x000000;
            format.textAlpha = .5;
            
            var span:SpanElement = new SpanElement();
            span.text = "The quick brown fox jumped over the lazy dog.";            
            span.format = format;
            
            var para:ParagraphElement = new ParagraphElement();
            para.addChild( span );
            
            flow.addChild( para );
            
            factory.createTextLines( useTextLines, flow );
            
            factory.compositionBounds = new Rectangle( 99, 99, 200, 130 );
            format.color = 0x990000;
            format.textAlpha = 1;
            span.format = format;
            factory.createTextLines( useTextLines, flow );
            
            graphics.beginFill(0x555555,.5);
            graphics.drawRect( 99, 99, 201, 131 );
            graphics.endFill();
        }
        
        private function useTextLines( lineOrShape:DisplayObject ):void
        {
            this.addChild( lineOrShape );
        }
        
    }
}
Thu Dec 4 2014, 05:50 PM -08:00