Adobe® Flex® 4 Language Reference
Show Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
flashx.textLayout.elements 
ParagraphElement 
Packageflashx.textLayout.elements
Classpublic final class ParagraphElement
InheritanceParagraphElement Inheritance ParagraphFormattedElement Inheritance FlowGroupElement Inheritance FlowElement Inheritance Object

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

The ParagraphElement class represents a paragraph in the text flow hierarchy. Its parent is a ParagraphFormattedElement, and its children can include spans (SpanElement), images (inLineGraphicElement), links (LinkElement) and TCY (Tatechuuyoko - ta-tae-chu-yo-ko) elements (TCYElement). The paragraph text is stored in one or more SpanElement objects, which define ranges of text that share the same attributes. A TCYElement object defines a small run of Japanese text that runs perpendicular to the line, as in a horizontal run of text in a vertical line. A TCYElement can also contain multiple spans.

Default MXML PropertymxmlChildren

View the examples

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
 InheritedmxmlChildren : Array
Appends an array of children to this object.
FlowGroupElement
 InheritednumChildren : 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
  
Constructor - represents a paragraph in a text flow.
ParagraphElement
 Inherited
Appends a child FlowElement object.
FlowGroupElement
 Inherited
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
 Inherited
findChildIndexAtPosition(relativePosition:int):int
Given a relative text position, find the index of the first child FlowElement that contains the relative position.
FlowGroupElement
 Inherited
findLeaf(relativePosition:int):FlowLeafElement
Given a relative text position, find the leaf element that contains the position.
FlowGroupElement
  
findNextAtomBoundary(relativePosition:int):int
Scans ahead from the supplied position to find the location in the text of the next atom and returns the index.
ParagraphElement
  
findNextWordBoundary(relativePosition:int):int
Returns the index of the next word boundary in the text.
ParagraphElement
  
findPreviousAtomBoundary(relativePosition:int):int
Scans backward from the supplied position to find the location in the text of the previous atom and returns the index.
ParagraphElement
  
findPreviousWordBoundary(relativePosition:int):int
Returns the index of the previous word boundary in the text.
ParagraphElement
 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
 Inherited
Returns the FlowElement child at the specified index.
FlowGroupElement
 Inherited
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
 Inherited
Returns the first FlowLeafElement descendant of this group.
FlowGroupElement
 Inherited
Returns the last FlowLeafElement descendent of this group.
FlowGroupElement
  
Returns the paragraph that follows this one, or null if there are no more paragraphs.
ParagraphElement
 Inherited
Returns the next FlowElement sibling in the text flow hierarchy.
FlowElement
 Inherited
Returns the ParagraphElement object associated with this element.
FlowElement
  
Returns the paragraph that precedes this one, or null, if this paragraph is the first one in the TextFlow.
ParagraphElement
 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
 Inherited
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
 Inherited
Removes the specified child FlowElement object from the group.
FlowGroupElement
 Inherited
Removes the child FlowElement object at the specified index position.
FlowGroupElement
 Inherited
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
 Inherited
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
Constructor Detail

ParagraphElement

()Constructor
public function ParagraphElement()

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

Constructor - represents a paragraph in a text flow.

Method Detail

findNextAtomBoundary

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

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

Scans ahead from the supplied position to find the location in the text of the next atom and returns the index. The term atom refers to both graphic elements and characters (including groups of combining characters), the indivisible entities that make up a text line.

Parameters

relativePosition:int — position in the text to start from, counting from 0

Returns
int — index in the text of the following atom

See also


Example  ( How to use this example )

This example finds the next atom boundaries from given offsets in 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 ParagraphElement_findNextAtomBoundary  extends Sprite
    {
        public function ParagraphElement_findNextAtomBoundary()
        {
            // create the TextFlow, ParagraphElement and SpanElement objects to hold paragraph
            var textFlow:TextFlow = new TextFlow();
            var paragraph:ParagraphElement = new ParagraphElement();    
            var span:SpanElement = new SpanElement();
            // assign text to the span; add span to paragraph and paragraph to TextFlow
            span.text = "Hello brave, new world!";
            paragraph.addChild(span);
            textFlow.addChild(paragraph);
            // assign a controller to the stage and update it to compose and display text
            textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
            textFlow.flowComposer.updateAllControllers();
            // find the next atom boundaries from offsets 5 and 10
            var atomBoundary:int = paragraph.findNextAtomBoundary(4);                           
            trace(atomBoundary); // 5 
            atomBoundary = paragraph.findNextAtomBoundary(10);                           
            trace(atomBoundary); // 11  
        }
    }
}

findNextWordBoundary

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

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

Returns the index of the next word boundary in the text.

Scans ahead from the supplied position to find the next position in the text that starts or ends a word.

Parameters

relativePosition:int — position in the text to start from, counting from 0

Returns
int — index in the text of the next word boundary

Example  ( How to use this example )

This example finds the next word boundaries in a paragraph from given offsets.
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 ParagraphElement_findNextWordBoundary  extends Sprite
    {
        public function ParagraphElement_findNextWordBoundary()
        {
            // create the TextFlow, ParagraphElement and SpanElement objects to hold paragraph
            var textFlow:TextFlow = new TextFlow();
            var paragraph:ParagraphElement = new ParagraphElement();    
            var span:SpanElement = new SpanElement();
            // assign text to the span; add span to paragraph and paragraph to TextFlow
            span.text = "Hello brave, new world!";
            paragraph.addChild(span);
            textFlow.addChild(paragraph);
            // assign a controller to the stage and update it to compose and display text
            textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
            textFlow.flowComposer.updateAllControllers();
            // find the next word boundary from offsets 0 and 12
            var wordBoundary:int = paragraph.findNextWordBoundary(0);                           
            trace(wordBoundary); // 5 
            wordBoundary = paragraph.findNextWordBoundary(12);                           
            trace(wordBoundary); // 13        
        }
    }
}

findPreviousAtomBoundary

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

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

Scans backward from the supplied position to find the location in the text of the previous atom and returns the index. The term atom refers to both graphic elements and characters (including groups of combining characters), the indivisible entities that make up a text line.

Parameters

relativePosition:int — position in the text to start from, counting from 0

Returns
int — index in the text of the previous cluster

See also


Example  ( How to use this example )

This example finds the previous atom boundaries from given offsets in 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 ParagraphElement_findPreviousAtomBoundary  extends Sprite
    {
        public function ParagraphElement_findPreviousAtomBoundary()
        {
            // create the TextFlow, ParagraphElement and SpanElement objects to hold paragraph
            var textFlow:TextFlow = new TextFlow();
            var paragraph:ParagraphElement = new ParagraphElement();    
            var span:SpanElement = new SpanElement();
            // assign text to the span; add span to paragraph and paragraph to TextFlow
            span.text = "Hello brave, new world!";
            paragraph.addChild(span);
            textFlow.addChild(paragraph);
            // assign a controller to the stage and update it to compose and display text
            textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
            textFlow.flowComposer.updateAllControllers();
            // find the previous atom boundaries from offsets 6 and 13
            var atomBoundary:int = paragraph.findPreviousAtomBoundary(6);                           
            trace(atomBoundary); // 5 
            atomBoundary = paragraph.findPreviousAtomBoundary(13);                           
            trace(atomBoundary); // 12      
        }
    }
}

findPreviousWordBoundary

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

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

Returns the index of the previous word boundary in the text.

Scans backward from the supplied position to find the previous position in the text that starts or ends a word.

Parameters

relativePosition:int — position in the text to start from, counting from 0

Returns
int — index in the text of the previous word boundary

Example  ( How to use this example )

This example finds the previous word boundaries in a paragraph from given offsets.
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 ParagraphElement_findPreviousWordBoundary  extends Sprite
    {
        public function ParagraphElement_findPreviousWordBoundary()
        {
            // create the TextFlow, ParagraphElement and SpanElement objects to hold paragraph
            var textFlow:TextFlow = new TextFlow();
            var paragraph:ParagraphElement = new ParagraphElement();    
            var span:SpanElement = new SpanElement();
            // assign text to the span; add span to paragraph and paragraph to TextFlow
            span.text = "Hello brave, new world!";
            paragraph.addChild(span);
            textFlow.addChild(paragraph);
            // assign a controller to the stage and update it to compose and display text
            textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
            textFlow.flowComposer.updateAllControllers();
            // find the previous word boundary from offsets 0 and 12
            var wordBoundary:int = paragraph.findPreviousWordBoundary(22);                           
            trace(wordBoundary); // 17 
            wordBoundary = paragraph.findPreviousWordBoundary(11);                           
            trace(wordBoundary); // 6  
        }
    }
}

getNextParagraph

()method 
public function getNextParagraph():ParagraphElement

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

Returns the paragraph that follows this one, or null if there are no more paragraphs.

Returns
ParagraphElement — the next paragraph or null if there are no more paragraphs.

See also


Example  ( How to use this example )

This example imports three paragraphs of text from xml markup, accesses the first paragraph using getChildAtIndex(0), and uses getNextParagraph() to access the second paragraph.
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 ParagraphElement_getNextParagraph  extends Sprite
    {
        public function ParagraphElement_getNextParagraph()
        {
            // create TextFlow object
            var textFlow:TextFlow = new TextFlow();        
            // create content for TextFlow using XML markup
            var simpleText:String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<flow:TextFlow xmlns:flow=\"http://ns.adobe.com/textLayout/2008\">"+
                    "<flow:p>"+
                        "<flow:span>This is the first paragraph.</flow:span>"+    
                    "</flow:p>"+
                    "<flow:p>"+
                        "<flow:span>This is the second paragraph.</flow:span>"+    
                    "</flow:p>"+
                    "<flow:p>"+
                        "<flow:span>This is the third paragraph.</flow:span>"+ 
                    "</flow:p>"+
                "</flow:TextFlow>";
            // import the xml markup into a TextFlow object and display it on the stage
            textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
            textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
            textFlow.flowComposer.updateAllControllers();
            // get first paragraph
            var p:ParagraphElement = textFlow.getChildAt(0) as ParagraphElement;
            // get next paragraph and display its content
            var nextParagraph:ParagraphElement = p.getNextParagraph();
            trace("nextParagraph.text is: " + nextParagraph.getText());
        }
    }
}

getPreviousParagraph

()method 
public function getPreviousParagraph():ParagraphElement

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

Returns the paragraph that precedes this one, or null, if this paragraph is the first one in the TextFlow.

Returns
ParagraphElement

See also


Example  ( How to use this example )

This example imports three paragraphs of text from xml markup, accesses the second paragraph using getChildAtIndex(1), and uses getPreviousParagraph() to access the first paragraph.
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 ParagraphElement_getPreviousParagraph  extends Sprite
    {
        public function ParagraphElement_getPreviousParagraph()
        {
            // create TextFlow object
            var textFlow:TextFlow = new TextFlow();        
            // create content for TextFlow using XML markup
            var simpleText:String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<flow:TextFlow xmlns:flow=\"http://ns.adobe.com/textLayout/2008\">"+
                    "<flow:p>"+
                        "<flow:span>This is the first paragraph.</flow:span>"+    
                    "</flow:p>"+
                    "<flow:p>"+
                        "<flow:span>This is the second paragraph.</flow:span>"+    
                    "</flow:p>"+
                    "<flow:p>"+
                        "<flow:span>This is the third paragraph.</flow:span>"+ 
                    "</flow:p>"+
                "</flow:TextFlow>";
            // import the xml markup into a TextFlow object and display it on the stage
            textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
            textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
            textFlow.flowComposer.updateAllControllers();
            // get second paragraph (first = 0)
            var p:ParagraphElement = textFlow.getChildAt(1) as ParagraphElement;
            // get  previous paragraph and display its content
            var prevParagraph:ParagraphElement = p.getPreviousParagraph();
            trace("prevParagraph.text is: " + prevParagraph.getText());
        }
    }
}

ParagraphElementExample.as

This example creates and formats three paragraphs of text.

package flashx.textLayout.elements.examples
{
    import flash.display.Sprite;
    import flash.text.engine.FontPosture;
    
    import flashx.textLayout.container.ContainerController;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.TextFlow;
    import flashx.textLayout.formats.TextLayoutFormat;

    public class ParagraphElementExample extends Sprite {
        
        // create the TextFlow object
        private var textFlow:TextFlow = new TextFlow();
        
        // Create Strings of text for the paragraphs
        private var para1String:String = "In the first paragraph of a "
        private var para1String2:String = "cheap" 
        private var para1String3:String ="Western novel, a cowboy meets a saloon girl.";
        private var para2String:String = "In the middle of the cheap novel a really bad guy, "+
                        "who is having a relationship with the saloon girl, sees the cowboy help "+
                        "her onto her horse as she smiles at him warmly."
        private var para3String:String = "In the last paragraph of the cheap novel, the cowboy kills "+
                            "the really bad guy in a shootout in the middle of main street and "+ 
                            "then rides into the sunset with the saloon girl on the back of his horse."; 
                  
        public function ParagraphElementExample()
        {
            // create a TextLayoutFormat object to use in formatting the paragraphs
            var textLayoutFormat:TextLayoutFormat = new TextLayoutFormat();
            var paragraph1:ParagraphElement = new ParagraphElement();
            
            // create the ParagraphElement objects
            var paragraph2:ParagraphElement = new ParagraphElement();
            var paragraph3:ParagraphElement = new ParagraphElement();
            
            // create the SpanElement objects to hold the content of the paragraphs
            var p1Span1:SpanElement = new SpanElement();
            var p1Span2:SpanElement = new SpanElement();
            var p1Span3:SpanElement = new SpanElement();
            var p2Span:SpanElement = new SpanElement();
            var p3Span:SpanElement = new SpanElement();
            
            // assign the strings of text for the 1st paragraph to spans
            p1Span1.text = para1String;
            p1Span2.text = para1String2;
            p1Span2.fontStyle = FontPosture.ITALIC;  // italicize 'cheap'
            p1Span3.text = para1String3;
            
            // add spans to first paragraph
            paragraph1.addChild(p1Span1);
            paragraph1.addChild(p1Span2);
            paragraph1.addChild(p1Span3);
            
            // assign the string of text for the 2nd paragraph to a span
            // and add the span to the second paragraph
            p2Span.text = para2String;
            paragraph2.addChild(p2Span);
            
            // assign the string of text for the 3rd paragraph to a span
            // and add the span to the third paragraph
            p3Span.text = para3String;
            paragraph3.addChild(p3Span);
            
            // add the paragraphs to the TextFlow
            textFlow.addChild(paragraph1);
            textFlow.addChild(paragraph2);
            textFlow.addChild(paragraph3);
            
            // set the text formatting properties
            textLayoutFormat.fontSize = 14;
            textLayoutFormat.textIndent = 15;
            textLayoutFormat.paragraphSpaceAfter = 15;
            textLayoutFormat.paddingTop = 4;
            textLayoutFormat.paddingLeft = 4;
            
            // assign the format object to the TextFlow
            textFlow.hostFormat = textLayoutFormat;
            
            // assign a controller to the stage and update it to compose and 
            // display the text
            textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
            textFlow.flowComposer.updateAllControllers();
        }
    }
}
ParagraphElementExample2.as

This example imports xml markup into a TextFlow object. The xml markup defines the same three paragraphs of text, and their formatting, as the preceding example.

package flashx.textLayout.elements.examples
{
    import flash.display.Sprite;
    import flashx.textLayout.elements.TextFlow;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.container.ContainerController;
    
    public class ParagraphElementExample2 extends Sprite {
        
        // create the TextFlow object
        private var textFlow:TextFlow = new TextFlow();
        
        // xml markup that defines the attributes and contents of a text flow
        private 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>In the first paragraph of a </flow:span>"+
                        "<flow:span fontStyle=\"italic\">cheap</flow:span>"+
                        "<flow:span> Western novel, a cowboy meets a saloon girl.</flow:span>"+
                    "</flow:p>"+
                    "<flow:p>"+
                        "<flow:span>In the middle of the cheap novel a really bad guy, </flow:span>"+
                        "<flow:span>who is having a relationship with the saloon girl, sees the cowboy help </flow:span>"+
                        "<flow:span>her onto her horse as she smiles at him warmly.</flow:span>"+ 
                    "</flow:p>"+
                    "<flow:p>"+
                        "<flow:span>In the last paragraph of the cheap novel, the cowboy kills the really </flow:span>"+ 
                        "<flow:span> bad guy in a shootout in the middle of main street and then rides into the sunset with </flow:span>"+
                        "<flow:span>the saloon girl on the back of his horse.</flow:span>" + 
                    "</flow:p>"+
                  "</flow:TextFlow>";
                  
        public function ParagraphElementExample2()
        {
            // import the xml markup into a TextFlow object and display it on the stage
            textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
            textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
            textFlow.flowComposer.updateAllControllers();
        }
    }
}