Adobe® Flex® 4 Language Reference
Show Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
flashx.textLayout.elements 
FlowGroupElement 
Packageflashx.textLayout.elements
Classpublic class FlowGroupElement
InheritanceFlowGroupElement Inheritance FlowElement Inheritance Object
Subclasses ParagraphFormattedElement, SubParagraphGroupElement

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

The FlowGroupElement class is the base class for FlowElement objects that can have an array of children. These classes include TextFlow, ParagraphElement, DivElement, and LinkElement.

You cannot create a FlowGroupElement object directly. Invoking new FlowGroupElement() throws an error exception.

Default MXML PropertymxmlChildren

See also



Public Properties
 PropertyDefined By
 InheritedalignmentBaseline : *
TextLayoutFormat: Specifies the baseline to which the dominant baseline aligns.
FlowElement
 InheritedbackgroundAlpha : *
TextLayoutFormat: Alpha (transparency) value for the background (adopts default value if undefined during cascade).
FlowElement
 InheritedbackgroundColor : *
TextLayoutFormat: Background color of the text (adopts default value if undefined during cascade).
FlowElement
 InheritedbaselineShift : *
TextLayoutFormat: Amount to shift the baseline from the dominantBaseline value.
FlowElement
 InheritedblockProgression : *
TextLayoutFormat: Specifies a vertical or horizontal progression of line placement.
FlowElement
 InheritedbreakOpportunity : *
TextLayoutFormat: Controls where lines are allowed to break when breaking wrapping text into multiple lines.
FlowElement
 InheritedcffHinting : *
TextLayoutFormat: The type of CFF hinting used for this text.
FlowElement
 Inheritedcolor : *
TextLayoutFormat: Color of the text.
FlowElement
 InheritedcolumnCount : *
TextLayoutFormat: Number of text columns (adopts default value if undefined during cascade).
FlowElement
 InheritedcolumnGap : *
TextLayoutFormat: Specifies the amount of gutter space, in pixels, to leave between the columns (adopts default value if undefined during cascade).
FlowElement
 InheritedcolumnWidth : *
TextLayoutFormat: Column width in pixels (adopts default value if undefined during cascade).
FlowElement
 InheritedcomputedFormat : flashx.textLayout.formats:ITextLayoutFormat
[read-only] Returns the computed format attributes that are in effect for this element.
FlowElement
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheritedcoreStyles : Object
[read-only] Returns the core styles on a FlowElement instance.
FlowElement
 InheriteddigitCase : *
TextLayoutFormat: The type of digit case used for this text.
FlowElement
 InheriteddigitWidth : *
TextLayoutFormat: Type of digit width used for this text.
FlowElement
 Inheriteddirection : *
TextLayoutFormat: Specifies the default bidirectional embedding level of the text in the text block.
FlowElement
 InheriteddominantBaseline : *
TextLayoutFormat: Specifies which element baseline snaps to the alignmentBaseline to determine the vertical position of the element on the line.
FlowElement
 InheritedfirstBaselineOffset : *
TextLayoutFormat: Specifies the baseline position of the first line in the container.
FlowElement
 InheritedfontFamily : *
TextLayoutFormat: The name of the font to use, or a comma-separated list of font names.
FlowElement
 InheritedfontLookup : *
TextLayoutFormat: Font lookup to use.
FlowElement
 InheritedfontSize : *
TextLayoutFormat: The size of the text in pixels.
FlowElement
 InheritedfontStyle : *
TextLayoutFormat: Style of text.
FlowElement
 InheritedfontWeight : *
TextLayoutFormat: Weight of text.
FlowElement
 Inheritedformat : flashx.textLayout.formats:ITextLayoutFormat
TextLayoutFormat properties applied directly to this element.
FlowElement
 Inheritedid : String
Assigns an identifying name to the element, making it possible to set a style for the element by referencing the id.
FlowElement
 InheritedjustificationRule : *
TextLayoutFormat: Rule used to justify text in a paragraph.
FlowElement
 InheritedjustificationStyle : *
TextLayoutFormat: The style used for justification of the paragraph.
FlowElement
 Inheritedkerning : *
TextLayoutFormat: Kerning adjusts the pixels between certain character pairs to improve readability.
FlowElement
 InheritedleadingModel : *
TextLayoutFormat: Specifies the leading model, which is a combination of leading basis and leading direction.
FlowElement
 InheritedligatureLevel : *
TextLayoutFormat: Controls which of the ligatures that are defined in the font may be used in the text.
FlowElement
 InheritedlineBreak : *
TextLayoutFormat: Controls word wrapping within the container (adopts default value if undefined during cascade).
FlowElement
 InheritedlineHeight : *
TextLayoutFormat: Leading controls for the text.
FlowElement
 InheritedlineThrough : *
TextLayoutFormat: If true, applies strikethrough, a line drawn through the middle of the text.
FlowElement
 InheritedlinkActiveFormat : *
Defines the formatting attributes used for links in active state, when the mouse is down on a link.
FlowElement
 InheritedlinkHoverFormat : *
Defines the formatting attributes used for links in hover state, when the mouse is within the bounds (rolling over) a link.
FlowElement
 InheritedlinkNormalFormat : *
Defines the formatting attributes used for links in normal state.
FlowElement
 Inheritedlocale : *
TextLayoutFormat: The locale of the text.
FlowElement
  mxmlChildren : Array
Appends an array of children to this object.
FlowGroupElement
  numChildren : int
[read-only] Returns the number of FlowElement children that this FlowGroupElement object has.
FlowGroupElement
 InheritedpaddingBottom : *
TextLayoutFormat: Botttom inset in pixels (adopts default value if undefined during cascade).
FlowElement
 InheritedpaddingLeft : *
TextLayoutFormat: Left inset in pixels (adopts default value if undefined during cascade).
FlowElement
 InheritedpaddingRight : *
TextLayoutFormat: Right inset in pixels (adopts default value if undefined during cascade).
FlowElement
 InheritedpaddingTop : *
TextLayoutFormat: Top inset in pixels (adopts default value if undefined during cascade).
FlowElement
 InheritedparagraphEndIndent : *
TextLayoutFormat: A Number that specifies, in pixels, the amount to indent the paragraph's end edge.
FlowElement
 InheritedparagraphSpaceAfter : *
TextLayoutFormat: A Number that specifies the amount of space, in pixels, to leave after the paragraph.
FlowElement
 InheritedparagraphSpaceBefore : *
TextLayoutFormat: A Number that specifies the amount of space, in pixels, to leave before the paragraph.
FlowElement
 InheritedparagraphStartIndent : *
TextLayoutFormat: A Number that specifies, in pixels, the amount to indent the paragraph's start edge.
FlowElement
 Inheritedparent : FlowGroupElement
[read-only] Returns the parent of this FlowElement object.
FlowElement
 InheritedparentRelativeEnd : int
[read-only] Returns the relative end of this FlowElement object in the parent.
FlowElement
 InheritedparentRelativeStart : int
[read-only] Returns the relative start of this FlowElement object in the parent.
FlowElement
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
 InheritedrenderingMode : *
TextLayoutFormat: The rendering mode used for this text.
FlowElement
 InheritedstyleName : String
Assigns an identifying class to the element, making it possible to set a style for the element by referencing the styleName.
FlowElement
 InheritedtabStops : *
TextLayoutFormat: Specifies the tab stops associated with the paragraph.
FlowElement
 InheritedtextAlign : *
TextLayoutFormat: Alignment of lines in the paragraph relative to the container.
FlowElement
 InheritedtextAlignLast : *
TextLayoutFormat: Alignment of the last (or only) line in the paragraph relative to the container in justified text.
FlowElement
 InheritedtextAlpha : *
TextLayoutFormat: Alpha (transparency) value for the text.
FlowElement
 InheritedtextDecoration : *
TextLayoutFormat: Decoration on text.
FlowElement
 InheritedtextIndent : *
TextLayoutFormat: A Number that specifies, in pixels, the amount to indent the first line of the paragraph.
FlowElement
 InheritedtextJustify : *
TextLayoutFormat: Specifies options for justifying text.
FlowElement
 InheritedtextLength : int
[read-only] Returns the total length of text owned by this FlowElement object and its children.
FlowElement
 InheritedtextRotation : *
TextLayoutFormat: Determines the number of degrees to rotate this text.
FlowElement
 Inheritedtracking : Object
[write-only] Sets the tracking and is synonymous with the trackingRight property.
FlowElement
 InheritedtrackingLeft : *
TextLayoutFormat: Number in pixels (or percent of fontSize, like 120%) indicating the amount of tracking (manual kerning) to be applied to the left of each character.
FlowElement
 InheritedtrackingRight : *
TextLayoutFormat: Number in pixels (or percent of fontSize, like 120%) indicating the amount of tracking (manual kerning) to be applied to the right of each character.
FlowElement
 InheritedtypographicCase : *
TextLayoutFormat: The type of typographic case used for this text.
FlowElement
 InheriteduserStyles : Object
Allows you to read and write user styles on a FlowElement object.
FlowElement
 InheritedverticalAlign : *
TextLayoutFormat: Vertical alignment or justification (adopts default value if undefined during cascade).
FlowElement
 InheritedwhiteSpaceCollapse : *
TextLayoutFormat: Collapses or preserves whitespace when importing text into a TextFlow.
FlowElement
Public Methods
 MethodDefined By
  
Base class - invoking new FlowGroupElement() throws an error exception.
FlowGroupElement
  
Appends a child FlowElement object.
FlowGroupElement
  
Adds a child FlowElement object at the specified index position.
FlowGroupElement
 Inherited
Clears the style specified by the styleProp parameter from this FlowElement object.
FlowElement
 Inherited
deepCopy(relativeStart:int = 0, relativeEnd:int = -1):FlowElement
Makes a deep copy of this FlowElement object, including any children, copying the content between the two specified character positions and returning the copy as a FlowElement object.
FlowElement
 Inherited
Compare the userStyles of this with otherElement's userStyles.
FlowElement
  
findChildIndexAtPosition(relativePosition:int):int
Given a relative text position, find the index of the first child FlowElement that contains the relative position.
FlowGroupElement
  
findLeaf(relativePosition:int):FlowLeafElement
Given a relative text position, find the leaf element that contains the position.
FlowGroupElement
 Inherited
Returns the start location of the element in the text flow as an absolute index.
FlowElement
 Inherited
getCharAtPosition(relativePosition:int):String
Returns the character at the specified position, relative to this FlowElement object.
FlowElement
 Inherited
getCharCodeAtPosition(relativePosition:int):int
Returns the character code at the specified position, relative to this FlowElement.
FlowElement
  
Returns the FlowElement child at the specified index.
FlowGroupElement
  
Searches in children for the specified FlowElement object and returns its index position.
FlowGroupElement
 Inherited
Returns the start of this element relative to an ancestor element.
FlowElement
  
Returns the first FlowLeafElement descendant of this group.
FlowGroupElement
  
Returns the last FlowLeafElement descendent of this group.
FlowGroupElement
 Inherited
Returns the next FlowElement sibling in the text flow hierarchy.
FlowElement
 Inherited
Returns the ParagraphElement object associated with this element.
FlowElement
 Inherited
Returns the previous FlowElement sibling in the text flow hierarchy.
FlowElement
 Inherited
getStyle(styleProp:String):*
Returns the value of the style specified by the styleProp parameter, which specifies the style name and can include any user style name.
FlowElement
  
getText(relativeStart:int = 0, relativeEnd:int = -1, paragraphSeparator:String = " "):String
[override]
FlowGroupElement
 Inherited
Climbs the text flow hierarchy to return the root TextFlow object for the element.
FlowElement
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Called for MXML objects after the implementing object has been created and all component properties specified on the MXML tag have been initialized.
FlowElement
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
  
Removes the specified child FlowElement object from the group.
FlowGroupElement
  
Removes the child FlowElement object at the specified index position.
FlowGroupElement
  
replaceChildren(beginChildIndex:int, endChildIndex:int, ... rest):void
Replaces child elements in the group with the specified new elements.
FlowGroupElement
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
setStyle(styleProp:String, newValue:*):void
Sets the style specified by the styleProp parameter to the value specified by the newValue parameter.
FlowElement
 Inherited
shallowCopy(relativeStart:int = 0, relativeEnd:int = -1):FlowElement
Makes a copy of this FlowElement object, copying the content between two specified character positions.
FlowElement
  
Splits this object at the position specified by the childIndex parameter.
FlowGroupElement
 Inherited
splitAtPosition(relativePosition:int):FlowElement
Splits this FlowElement object at the position specified by the relativePosition parameter, which is a relative position in the text for this element.
FlowElement
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail

mxmlChildren

property
mxmlChildren:Array

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Appends an array of children to this object. Uses the replaceChildren() method to append each element in the array. Intended for use during an mxml compiled import.



Implementation
    public function get mxmlChildren():Array
    public function set mxmlChildren(value:Array):void

Throws
TypeError — if array element is not a FlowElement or String

See also

numChildren

property 
numChildren:int  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Returns the number of FlowElement children that this FlowGroupElement object has.



Implementation
    public function get numChildren():int
Constructor Detail

FlowGroupElement

()Constructor
public function FlowGroupElement()

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Base class - invoking new FlowGroupElement() throws an error exception.

Method Detail

addChild

()method
public function addChild(child:FlowElement):FlowElement

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Appends a child FlowElement object. The new child is added to the end of the children list.

Parameters

child:FlowElement — The child element to append.

Returns
FlowElement — the added child FlowElement

Example  ( How to use this example )

This example calls addChild() to add a span to a paragraph and to add the paragraph to the text flow.
package flashx.textLayout.elements.examples {    
    import flash.display.Sprite;
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    
    public class FlowGroupElement_addChildExample extends Sprite
    {        
        public function FlowGroupElement_addChildExample()
        {
            // create string for text flow
            var simpleText:String = "It was a dark and stormy night.";        
                    
            // define TextFlow, ParagraphElement, and SpanElement objects
            var textFlow:TextFlow = new TextFlow();            
            var paragraph:ParagraphElement = new ParagraphElement();
            var span:SpanElement = new SpanElement;
            span.text = simpleText;
            // add span to paragraph and add paragraph to text flow
            paragraph.addChild(span);
            textFlow.addChild(paragraph);
            // assign composer and controller and update controller to display text
            textFlow.flowComposer.addController(new ContainerController(this,200,200));
            textFlow.flowComposer.updateAllControllers();
        }
    }
}

addChildAt

()method 
public function addChildAt(index:uint, child:FlowElement):FlowElement

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Adds a child FlowElement object at the specified index position.

Parameters

index:uint — index of the position at which to add the child element, with the first position being 0.
 
child:FlowElement — The child element to add.

Returns
FlowElement — the added child FlowElement

Throws
RangeError — The index is out of range.

Example  ( How to use this example )

This example calls addChildAt to add three spans to a paragraph.
package flashx.textLayout.elements.examples {    
    import flash.display.Sprite;
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    
    public class FlowGroupElement_addChildAtExample extends Sprite
    {        
        public function FlowGroupElement_addChildAtExample()
        {
            // define text strings for the contents of the text flow
            var textA:String = "It was a dark and stormy night. ";
            var textB:String = "The quick red fox jumped over the lazy brown dog. ";
            var textC:String = "Mary had a little lamb. ";
            // define TextFlow, ParagraphElement and SpanElement objects
            var textFlow:TextFlow = new TextFlow();            
            var paragraph:ParagraphElement = new ParagraphElement();
            var span1:SpanElement = new SpanElement();
            var span2:SpanElement = new SpanElement();
            var span3:SpanElement = new SpanElement();
            span1.text = textA;
            span2.text = textB;
            span3.text = textC;
            // add spans at specified positions
            paragraph.addChildAt(0, span2);
            paragraph.addChildAt(0, span1);
            paragraph.addChildAt(1, span3);
            textFlow.addChild(paragraph);
            // assign composer, controller, and update to display text
            textFlow.flowComposer.addController(new ContainerController(this,200,200));
            textFlow.flowComposer.updateAllControllers();
        }
    }
}

findChildIndexAtPosition

()method 
public function findChildIndexAtPosition(relativePosition:int):int

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Given a relative text position, find the index of the first child FlowElement that contains the relative position. More than one child can contain relative position because of zero length FlowElements.

Examine the children to find the FlowElement that contains the relative position. The supplied relative position is relative to this FlowElement.

Parameters

relativePosition:int — the position relative to this element

Returns
int — index of first child element containing relativePosition

Example  ( How to use this example )

This example finds the index of the child at a relative position in the text and sets its color to red.
    
package flashx.textLayout.elements.examples {    
    import flash.display.Sprite;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    
    public class FlowGroupElement_findChildIndexAtPositionExample extends Sprite
    {        
        public function FlowGroupElement_findChildIndexAtPositionExample()
        {
            // xml markup that defines the attributes and contents of a text flow
            var simpleText:String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<flow:TextFlow xmlns:flow=\"http://ns.adobe.com/textLayout/2008\" verticalScrollPolicy=\"auto\" horizontalScrollPolicy=\"auto\" editingMode=\"readWrite\" fontSize=\"14\" textIndent=\"15\" marginBottom=\"15\" paddingTop=\"4\" paddingLeft=\"4\">"+
                    "<flow:p>"+
                        "<flow:span id='span1'>It was a dark and stormy night.</flow:span>"+
                    "</flow:p>"+
                    "<flow:p>"+
                        "<flow:span>Peter Piper picked a </flow:span>"+
                        "<flow:span fontStyle=\"italic\"> peck </flow:span>"+
                        "<flow:span>of pickle peppers.</flow:span>"+
                    "</flow:p>"+
                "</flow:TextFlow>";
                    
            // define TextFlow object and import xml markup
            var textFlow:TextFlow = new TextFlow();
            textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
            // add composer and controller
            textFlow.flowComposer.addController(new ContainerController(this,200,200));
            // find the index of the child containing relative offset 21; set color to red
            var index:int = textFlow.findChildIndexAtPosition(21);
            textFlow.getChildAt(index).color = 0xFF0000;
            // display text
            textFlow.flowComposer.updateAllControllers();
        }
    }
}

findLeaf

()method 
public function findLeaf(relativePosition:int):FlowLeafElement

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Given a relative text position, find the leaf element that contains the position.

Looks down the flow element hierarchy to find the FlowLeafElement that contains the specified position. The specified position is relative to this FlowElement object.

Parameters

relativePosition:int — relative text index to look up.

Returns
FlowLeafElement — the leaf element containing the relative position.

Example  ( How to use this example )

This example creates two paragraphs, finds the FlowLeafElement at relative position 55, and sets its color to red.
package flashx.textLayout.elements.examples {    
    import flash.display.Sprite;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    
    public class FlowGroupElement_findLeafExample extends Sprite
    {        
        public function FlowGroupElement_findLeafExample()
        {
            // xml markup that defines the attributes and contents of a text flow
            var simpleText:String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<flow:TextFlow xmlns:flow=\"http://ns.adobe.com/textLayout/2008\" verticalScrollPolicy=\"auto\" horizontalScrollPolicy=\"auto\" editingMode=\"readWrite\" fontSize=\"14\" textIndent=\"15\" marginBottom=\"15\" paddingTop=\"4\" paddingLeft=\"4\">"+
                    "<flow:p>"+
                        "<flow:span>It was a dark and stormy night</flow:span>"+
                    "</flow:p>"+
                    "<flow:p>"+
                        "<flow:span>Peter Piper picked a </flow:span>"+
                        "<flow:span fontStyle=\"italic\"> peck </flow:span>"+
                        "<flow:span>of pickle peppers.</flow:span>"+
                    "</flow:p>"+
                "</flow:TextFlow>";
                    
            // define TextFlow object and import xml markup
            var textFlow:TextFlow = new TextFlow();
            textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
            // add composer and controller
            textFlow.flowComposer.addController(new ContainerController(this,200,200));
            // find the FlowLeafElement object containing relative offset 55; set color to red
            var leaf:SpanElement = textFlow.findLeaf(55) as SpanElement;
            leaf.color = 0xFF0000;
            // display text
            textFlow.flowComposer.updateAllControllers();
        }
    }
}

getChildAt

()method 
public function getChildAt(index:int):FlowElement

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Returns the FlowElement child at the specified index.

Parameters

index:int — the position at which to find the FlowElement object.

Returns
FlowElement — the child FlowElement object at the specified position.

Example  ( How to use this example )

This example uses the getChildAt() method to access a paragraph in the text flow and change the color of one of its spans to red.
    
package flashx.textLayout.elements.examples {    
    import flash.display.Sprite;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    
    public class FlowGroupElement_getChildAtExample extends Sprite
    {        
        public function FlowGroupElement_getChildAtExample()
        {
            // xml markup that defines the attributes and contents of a text flow
            var simpleText:String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<flow:TextFlow xmlns:flow=\"http://ns.adobe.com/textLayout/2008\" verticalScrollPolicy=\"auto\" horizontalScrollPolicy=\"auto\" editingMode=\"readWrite\" fontSize=\"14\" textIndent=\"15\" marginBottom=\"15\" paddingTop=\"4\" paddingLeft=\"4\">"+
                    "<flow:p>"+
                        "<flow:span id='span1'>It was a dark and stormy night.</flow:span>"+
                    "</flow:p>"+
                    "<flow:p>"+
                        "<flow:span>Peter Piper picked a </flow:span>"+
                        "<flow:span fontStyle=\"italic\"> peck </flow:span>"+
                        "<flow:span>of pickle peppers.</flow:span>"+
                    "</flow:p>"+
                "</flow:TextFlow>";
                    
            // define TextFlow object and import xml markup
            var textFlow:TextFlow = new TextFlow();
            textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
            // add composer and controller
            textFlow.flowComposer.addController(new ContainerController(this,200,200));
            // find the paragraph at index position 1
            var para:ParagraphElement = textFlow.getChildAt(1) as ParagraphElement;
            // find the span at index position 1 of the paragraph and color it red
            para.getChildAt(1).color = 0xFF0000;
            // display text
            textFlow.flowComposer.updateAllControllers();
        }
    }
}

getChildIndex

()method 
public function getChildIndex(child:FlowElement):int

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Searches in children for the specified FlowElement object and returns its index position.

Parameters

child:FlowElement — The FlowElement object item to locate among the children.

Returns
int — The index position of the specified chilc. If child is not found, returns -1.

getFirstLeaf

()method 
public function getFirstLeaf():FlowLeafElement

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Returns the first FlowLeafElement descendant of this group.

Returns
FlowLeafElement — the first FlowLeafElement object.

Example  ( How to use this example )

This example creates two paragraphs, finds the first FlowLeafElement object and sets its color to red.
        
package flashx.textLayout.elements.examples {    
    import flash.display.Sprite;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    
    public class FlowGroupElement_getFirstLeafExample extends Sprite
    {        
        public function FlowGroupElement_getFirstLeafExample()
        {
            // xml markup that defines the attributes and contents of a text flow
            var simpleText:String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<flow:TextFlow xmlns:flow=\"http://ns.adobe.com/textLayout/2008\" verticalScrollPolicy=\"auto\" horizontalScrollPolicy=\"auto\" editingMode=\"readWrite\" fontSize=\"14\" textIndent=\"15\" marginBottom=\"15\" paddingTop=\"4\" paddingLeft=\"4\">"+
                    "<flow:p>"+
                        "<flow:span>It was a </flow:span>"+
                        "<flow:span fontStyle=\"italic\">dark and stormy</flow:span>"+
                        "<flow:span> night.</flow:span>"+
                    "</flow:p>"+
                    "<flow:p>"+
                        "<flow:span>Peter Piper picked a peck of pickle peppers. </flow:span>"+
                    "</flow:p>"+
                "</flow:TextFlow>";
                    
            // define TextFlow object and import xml markup
            var textFlow:TextFlow = new TextFlow();
            textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
            // get first FlowLeafElement object and set its color to red
            var leaf:SpanElement = textFlow.getFirstLeaf() as SpanElement;
            leaf.color = 0xFF0000;
            // add composer and controller and update controller to display text
            textFlow.flowComposer.addController(new ContainerController(this,200,200));
            textFlow.flowComposer.updateAllControllers();
        }
    }
}

getLastLeaf

()method 
public function getLastLeaf():FlowLeafElement

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Returns the last FlowLeafElement descendent of this group.

Returns
FlowLeafElement — the last FlowLeafElement object.

Example  ( How to use this example )

This example creates two paragraphs, finds the last FlowLeafElement object and sets its color to red.
    
package flashx.textLayout.elements.examples {    
    import flash.display.Sprite;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    
    public class FlowGroupElement_getLastLeafExample extends Sprite
    {        
        public function FlowGroupElement_getLastLeafExample()
        {
            // xml markup that defines the attributes and contents of a text flow
            var simpleText:String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<flow:TextFlow xmlns:flow=\"http://ns.adobe.com/textLayout/2008\" verticalScrollPolicy=\"auto\" horizontalScrollPolicy=\"auto\" editingMode=\"readWrite\" fontSize=\"14\" textIndent=\"15\" marginBottom=\"15\" paddingTop=\"4\" paddingLeft=\"4\">"+
                    "<flow:p>"+
                        "<flow:span>It was a dark and stormy night</flow:span>"+
                    "</flow:p>"+
                    "<flow:p>"+
                        "<flow:span>Peter Piper picked a </flow:span>"+
                        "<flow:span fontStyle=\"italic\"> peck </flow:span>"+
                        "<flow:span>of pickle peppers.</flow:span>"+
                    "</flow:p>"+
                "</flow:TextFlow>";
                    
            // define TextFlow object and import xml markup
            var textFlow:TextFlow = new TextFlow();
            textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
            // add composer and controller
            textFlow.flowComposer.addController(new ContainerController(this,600,600));
            //find last leaf, set its color to red and display text
            var leaf:SpanElement = textFlow.getLastLeaf() as SpanElement;
            leaf.color = 0xFF0000;
            textFlow.flowComposer.updateAllControllers();
        }
    }
}

getText

()method 
override public function getText(relativeStart:int = 0, relativeEnd:int = -1, paragraphSeparator:String = " "):String

Parameters

relativeStart:int (default = 0)
 
relativeEnd:int (default = -1)
 
paragraphSeparator:String (default = " ")

Returns
String

removeChild

()method 
public function removeChild(child:FlowElement):FlowElement

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Removes the specified child FlowElement object from the group.

Parameters

child:FlowElement — The child element to remove.

Returns
FlowElement — the removed child FlowElement object

Throws
ArgumentError — The child is not found.

Example  ( How to use this example )

This example removes the third span in the second paragraph of the text flow.
        
package flashx.textLayout.elements.examples {    
    import flash.display.Sprite;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    
    public class FlowGroupElement_removeChildExample extends Sprite
    {        
        public function FlowGroupElement_removeChildExample()
        {
            // xml markup that defines the attributes and contents of a text flow
            var simpleText:String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<flow:TextFlow xmlns:flow=\"http://ns.adobe.com/textLayout/2008\" verticalScrollPolicy=\"auto\" horizontalScrollPolicy=\"auto\" editingMode=\"readWrite\" fontSize=\"14\" textIndent=\"15\" marginBottom=\"15\" paddingTop=\"4\" paddingLeft=\"4\">"+
                    "<flow:p id='para1'>"+
                        "<flow:span id='span1'>It was a dark and stormy night.</flow:span>"+
                    "</flow:p>"+
                    "<flow:p id='para2'>"+
                        "<flow:span id='span2'>Peter Piper picked a </flow:span>"+
                        "<flow:span id='span3' fontStyle=\"italic\"> peck </flow:span>"+
                        "<flow:span id='span4'>of pickle peppers.</flow:span>"+
                    "</flow:p>"+
                "</flow:TextFlow>";
                    
            // define TextFlow object and import xml markup
            var textFlow:TextFlow = new TextFlow();
            textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
            // add composer and controller
            textFlow.flowComposer.addController(new ContainerController(this,600,600));
            // get paragraph with ID = 'para2' and remove its child with name = 'span4'
            var parent:ParagraphElement = textFlow.getElementByID("para2") as ParagraphElement;
            parent.removeChild(textFlow.getElementByID("span4"));
            // update controller to display text
            textFlow.flowComposer.updateAllControllers();
        }
    }
}

removeChildAt

()method 
public function removeChildAt(index:uint):FlowElement

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Removes the child FlowElement object at the specified index position.

Parameters

index:uint — position at which to remove the child element.

Returns
FlowElement — the child FlowElement object removed from the specified position.

Throws
RangeError — The index is out of range.

Example  ( How to use this example )

This example calls removeChildAt() to remove the second of three paragraphs.
package flashx.textLayout.elements.examples {    
    import flash.display.Sprite;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    
    public class FlowGroupElement_removeChildAtExample extends Sprite
    {        
        public function FlowGroupElement_removeChildAtExample()
        {
            // xml markup that defines the attributes and contents of a text flow
            var simpleText:String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<flow:TextFlow xmlns:flow=\"http://ns.adobe.com/textLayout/2008\" verticalScrollPolicy=\"auto\" horizontalScrollPolicy=\"auto\" editingMode=\"readWrite\" fontSize=\"14\" textIndent=\"15\" marginBottom=\"15\" paddingTop=\"4\" paddingLeft=\"4\">"+
                    "<flow:p>"+
                        "<flow:span>It was a dark and stormy night. </flow:span>"+
                    "</flow:p>"+
                    "<flow:p>"+
                        "<flow:span>Peter Piper picked a peck of pickle peppers. </flow:span>"+
                    "</flow:p>"+
                    "<flow:p>"+
                        "<flow:span>Mary had a little lamb. </flow:span>"+
                    "</flow:p>"+
                "</flow:TextFlow>";
                    
            // define TextFlow, import text, add composer and controller 
            var textFlow:TextFlow = new TextFlow();
            textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
            textFlow.flowComposer.addController(new ContainerController(this,200,200));
            // remove child at index position 1 (with first position = 0); display text
            textFlow.removeChildAt(1);
            textFlow.flowComposer.updateAllControllers();
        }
    }
}

replaceChildren

()method 
public function replaceChildren(beginChildIndex:int, endChildIndex:int, ... rest):void

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Replaces child elements in the group with the specified new elements. Use the beginChildIndex and endChildIndex parameters to govern the operation as follows:

  • To delete elements, do not pass any replacement elements.
  • To insert elements, pass the same value for beginChildIndex and endChildIndex. The new elements is inserted before the specified index.
  • To append elements, pass numChildren for beginChildIndex and endChildIndex.

Otherwise, this method replaces the specified elements, starting with the element at beginChildIndex and up to but not including endChildIndex.

Parameters

beginChildIndex:int — The index value for the start position of the replacement range in the children array.
 
endChildIndex:int — The index value following the end position of the replacement range in the children array.
 
... rest — The elements to replace the specified range of elements. Can be a sequence containing flow elements or arrays or vectors thereof.


Throws
RangeError — The beginChildIndex or endChildIndex specified is out of range.

Example  ( How to use this example )

This example replaces the three spans in the second paragraph with two new ones.
package flashx.textLayout.elements.examples {    
    import flash.display.Sprite;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    
    public class FlowGroupElement_replaceChildrenExample extends Sprite
    {        
        public function FlowGroupElement_replaceChildrenExample()
        {
            // xml markup that defines the attributes and contents of a text flow
            var simpleText:String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<flow:TextFlow xmlns:flow=\"http://ns.adobe.com/textLayout/2008\" verticalScrollPolicy=\"auto\" horizontalScrollPolicy=\"auto\" editingMode=\"readWrite\" fontSize=\"14\" textIndent=\"15\" marginBottom=\"15\" paddingTop=\"4\" paddingLeft=\"4\">"+
                    "<flow:p id='para1'>"+
                        "<flow:span id='span1'>It was a dark and stormy night.</flow:span>"+
                    "</flow:p>"+
                    "<flow:p id='para2'>"+
                        "<flow:span id='span2'>Peter Piper picked a </flow:span>"+
                        "<flow:span id='span3' fontStyle=\"italic\"> peck </flow:span>"+
                        "<flow:span id='span4'>of pickle peppers.</flow:span>"+
                    "</flow:p>"+
                "</flow:TextFlow>";
            
            // define TextFlow object and import xml markup
            var textFlow:TextFlow = new TextFlow();
            textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
            // define two new SpanElement objects
            var span1:SpanElement = new SpanElement();
            var span2:SpanElement = new SpanElement();
            span1.text = "Mary had a little lamb. ";
            span2.text = "And this little pig stayed home. ";
            // add composer and controller
            textFlow.flowComposer.addController(new ContainerController(this,200,600));
            // get paragraph with ID = 'para2' and replace its children with span1 and span2
            var parent:ParagraphElement = textFlow.getElementByID("para2") as ParagraphElement;
            parent.replaceChildren(0, 3, [span1, span2]);
            // update controller to display text
            textFlow.flowComposer.updateAllControllers();
        }
    }
}

splitAtIndex

()method 
public function splitAtIndex(childIndex:int):FlowGroupElement

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10, AIR 1.5

Splits this object at the position specified by the childIndex parameter. If this group element has a parent, creates a shallow copy of this object and replaces its children with the elements up to the index. Moves elements following childIndex into the copy.

Parameters

childIndex:int

Returns
FlowGroupElement — the new FlowGroupElement object.

Throws
RangeError — if childIndex is greater than the length of the children.