ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
flashx.textLayout.elements 

FlowLeafElement  - AS3

Packageflashx.textLayout.elements
Classpublic class FlowLeafElement
InheritanceFlowLeafElement Inheritance FlowElement Inheritance Object
Subclasses InlineGraphicElement, SpanElement

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

Base class for FlowElements that appear at the lowest level of the flow hierarchy. FlowLeafElement objects have no children and include InlineGraphicElement objects and SpanElement objects.

Related API Elements



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
 InheritedclearFloats : *
TextLayoutFormat: Controls how text wraps around a float.
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
  computedFormat : flashx.textLayout.formats:ITextLayoutFormat
[override] [read-only] The computed text format attributes that are in effect for this element.
FlowLeafElement
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 InheritedcoreStyles : Object
[read-only] Returns the coreStyles on this FlowElement.
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 : *
TextLayoutFormat: Defines the formatting attributes used for links in normal state.
FlowElement
 InheritedlinkHoverFormat : *
TextLayoutFormat: Defines the formatting attributes used for links in hover state, when the mouse is within the bounds (rolling over) a link.
FlowElement
 InheritedlinkNormalFormat : *
TextLayoutFormat: Defines the formatting attributes used for links in normal state.
FlowElement
 InheritedlistAutoPadding : *
TextLayoutFormat: This specifies an auto indent for the start edge of lists when the padding value of the list on that side is auto.
FlowElement
 InheritedlistMarkerFormat : *
TextLayoutFormat: Defines the formatting attributes list markers.
FlowElement
 InheritedlistStylePosition : *
TextLayoutFormat: Legal values are ListStylePosition.INSIDE, ListStylePosition.OUTSIDE, FormatValue.INHERIT. Default value is undefined indicating not set. If undefined during the cascade this property will inherit its value from an ancestor.
FlowElement
 InheritedlistStyleType : *
TextLayoutFormat: Legal values are ListStyleType.UPPER_ALPHA, ListStyleType.LOWER_ALPHA, ListStyleType.UPPER_ROMAN, ListStyleType.LOWER_ROMAN, ListStyleType.NONE, ListStyleType.DISC, ListStyleType.CIRCLE, ListStyleType.SQUARE, ListStyleType.BOX, ListStyleType.CHECK, ListStyleType.DIAMOND, ListStyleType.HYPHEN, ListStyleType.ARABIC_INDIC, ListStyleType.BENGALI, ListStyleType.DECIMAL, ListStyleType.DECIMAL_LEADING_ZERO, ListStyleType.DEVANAGARI, ListStyleType.GUJARATI, ListStyleType.GURMUKHI, ListStyleType.KANNADA, ListStyleType.PERSIAN, ListStyleType.THAI, ListStyleType.URDU, ListStyleType.CJK_EARTHLY_BRANCH, ListStyleType.CJK_HEAVENLY_STEM, ListStyleType.HANGUL, ListStyleType.HANGUL_CONSTANT, ListStyleType.HIRAGANA, ListStyleType.HIRAGANA_IROHA, ListStyleType.KATAKANA, ListStyleType.KATAKANA_IROHA, ListStyleType.LOWER_ALPHA, ListStyleType.LOWER_GREEK, ListStyleType.LOWER_LATIN, ListStyleType.UPPER_ALPHA, ListStyleType.UPPER_GREEK, ListStyleType.UPPER_LATIN, FormatValue.INHERIT. Default value is undefined indicating not set. If undefined during the cascade this property will inherit its value from an ancestor.
FlowElement
 Inheritedlocale : *
TextLayoutFormat: The locale of the text.
FlowElement
 InheritedpaddingBottom : *
TextLayoutFormat: Bottom inset in pixels.
FlowElement
 InheritedpaddingLeft : *
TextLayoutFormat: Left inset in pixels.
FlowElement
 InheritedpaddingRight : *
TextLayoutFormat: Right inset in pixels.
FlowElement
 InheritedpaddingTop : *
TextLayoutFormat: Top inset in pixels.
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
 InheritedrenderingMode : *
TextLayoutFormat: The rendering mode used for this text.
FlowElement
 InheritedstyleName : *
TextLayoutFormat: Assigns an identifying class to the element, making it possible to set a style for the element by referencing the styleName.
FlowElement
 Inheritedstyles : Object
[read-only] Returns the styles on this FlowElement.
FlowElement
 InheritedtabStops : *
TextLayoutFormat: Specifies the tab stops associated with the paragraph.
FlowElement
  text : String
[read-only] The text associated with the FlowLeafElement: The value for SpanElement subclass will be one character less than textLength if this is the last span in a ParagraphELement. The value for BreakElement subclass is a U+2028 The value for TabElement subclass is a tab The value for InlineGraphicElement subclass is U+FDEF
FlowLeafElement
 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
 InheritedtypeName : String
Each FlowElement has a typeName.
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
 InheritedwordSpacing : *
TextLayoutFormat: Specifies the optimum, minimum, and maximum spacing (as a multiplier of the width of a normal space) between words to use during justification.
FlowElement
Public Methods
 MethodDefined By
  
Base class - invoking new FlowLeafElement() throws an error exception.
FlowLeafElement
 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
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 FontMetrics object for the span.
FlowLeafElement
 Inherited
Returns the start of this element relative to an ancestor element.
FlowElement
  
Returns the next FlowLeafElement object.
FlowLeafElement
 Inherited
Returns the next FlowElement sibling in the text flow hierarchy.
FlowElement
 Inherited
Returns the ParagraphElement object associated with this element.
FlowElement
  
Returns the previous FlowLeafElement object.
FlowLeafElement
 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
Gets the specified range of text from a flow element.
FlowElement
 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
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
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

computedFormat

property
computedFormat:flashx.textLayout.formats:ITextLayoutFormat  [read-only] [override]

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

The computed text format attributes that are in effect for this element. Takes into account the inheritance of attributes.



Implementation
    override public function get computedFormat():flashx.textLayout.formats:ITextLayoutFormat

Related API Elements

text

property 
text:String  [read-only]

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

The text associated with the FlowLeafElement:

  • The value for SpanElement subclass will be one character less than textLength if this is the last span in a ParagraphELement.
  • The value for BreakElement subclass is a U+2028
  • The value for TabElement subclass is a tab
  • The value for InlineGraphicElement subclass is U+FDEF


Implementation
    public function get text():String

Related API Elements

Constructor Detail

FlowLeafElement

()Constructor
public function FlowLeafElement()

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

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

Method Detail

getComputedFontMetrics

()method
public function getComputedFontMetrics():FontMetrics

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

Returns the FontMetrics object for the span. The properties of the FontMetrics object describe the emBox, strikethrough position, strikethrough thickness, underline position, and underline thickness for the specified font.

Returns
FontMetrics — font metrics associated with the span

Related API Elements

getNextLeaf

()method 
public function getNextLeaf(limitElement:FlowGroupElement = null):FlowLeafElement

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

Returns the next FlowLeafElement object.

Parameters

limitElement:FlowGroupElement (default = null) — Specifies FlowGroupElement on whose last leaf to stop looking. A value of null (default) means search till no more elements.

Returns
FlowLeafElement — next FlowLeafElement or null if at the end

Example  ( How to use this example )

This example creates three paragraphs, each with three SpanElement objects. The example finds the first FlowLeafElement object and calls getNextLeaf() to iterate forward through each leaf element and trace its text, up to and including paragraph p2.

package flashx.textLayout.elements.examples {
    import flash.display.Sprite;
    import flashx.textLayout.elements.TextFlow;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.container.ContainerController;
    
    public class FlowLeafElement_getNextLeafExample extends Sprite{    
        private var textFlow:TextFlow = new TextFlow();

        public function FlowLeafElement_getNextLeafExample(){
            var fontSize:Number = 12;
            var textFlow:TextFlow = new TextFlow();
            
            var p1:ParagraphElement = new ParagraphElement();
            var p2:ParagraphElement = new ParagraphElement();
            var p3:ParagraphElement = new ParagraphElement();
            var p1Span1:SpanElement = new SpanElement();
            var p1Span2:SpanElement = new SpanElement();
            var p1Span3:SpanElement = new SpanElement();
            var p2Span1:SpanElement = new SpanElement();
            var p2Span2:SpanElement = new SpanElement();
            var p2Span3:SpanElement = new SpanElement();
            var p3Span1:SpanElement = new SpanElement();
            var p3Span2:SpanElement = new SpanElement();
            var p3Span3:SpanElement = new SpanElement();
            p1Span1.text = "Breathe.";
            p1Span1.fontSize = fontSize;
            p1Span2.text = "Walk.";
            p1Span2.fontSize = fontSize + 1;
            p1Span3.text = "Play.";
            p1Span3.fontSize = fontSize + 2;
            p1.addChild(p1Span1);
            p1.addChild(p1Span2);
            p1.addChild(p1Span3);
            p2Span1.text = "Study.";
            p2Span1.fontSize = fontSize + 3;
            p2Span2.text = "Work.";
            p2Span2.fontSize = fontSize + 4;
            p2Span3.text = "Marry.";
            p2Span3.fontSize = fontSize + 5;
            p2.fontSize = fontSize + 6;
            p2.addChild(p2Span1);
            p2.addChild(p2Span2);
            p2.addChild(p2Span3);
            p3Span1.text = "Retire.";
            p3Span1.fontSize = fontSize + 6;
            p3Span2.text = "Travel.";
            p3Span2.fontSize = fontSize + 7;
            p3Span3.text = "Rock." ;
            p3Span3.fontSize = fontSize + 8;
            p3.addChild(p3Span1);
            p3.addChild(p3Span2);
            p3.addChild(p3Span3);
            textFlow.addChild(p1);
            textFlow.addChild(p2);
            textFlow.addChild(p3);
            textFlow.flowComposer.addController(new ContainerController(this,600,600));
            textFlow.flowComposer.updateAllControllers();
            var leaf:SpanElement = new SpanElement();
            leaf = SpanElement(textFlow.getFirstLeaf());
            trace(leaf.text);
            while(leaf = SpanElement(leaf.getNextLeaf(p2)))
                trace(leaf.text);
        }
    }
}

getPreviousLeaf

()method 
public function getPreviousLeaf(limitElement:FlowGroupElement = null):FlowLeafElement

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

Returns the previous FlowLeafElement object.

Parameters

limitElement:FlowGroupElement (default = null) — Specifies the FlowGroupElement on whose first leaf to stop looking. null (default) means search till no more elements.

Returns
FlowLeafElement — previous leafElement or null if at the end

Example  ( How to use this example )

This example creates three paragraphs, each with three SpanElement objects. The example finds the last FlowLeafElement object, and calls getPreviousLeaf() to iterate backward through each leaf element and trace its text, through the limit element, paragraph p3.
package flashx.textLayout.elements.examples 
{    
    import flash.display.Sprite;
    import flashx.textLayout.elements.TextFlow;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.container.ContainerController;
    
    public class FlowLeafElement_getPreviousLeafExample extends Sprite
    {    
        public function FlowLeafElement_getPreviousLeafExample(){
            var textFlow:TextFlow = new TextFlow();
            var fontSize:Number = 12;
            
            var p1:ParagraphElement = new ParagraphElement();
            var p2:ParagraphElement = new ParagraphElement();
            var p3:ParagraphElement = new ParagraphElement();
            var p1Span1:SpanElement = new SpanElement();
            var p1Span2:SpanElement = new SpanElement();
            var p1Span3:SpanElement = new SpanElement();
            var p2Span1:SpanElement = new SpanElement();
            var p2Span2:SpanElement = new SpanElement();
            var p2Span3:SpanElement = new SpanElement();
            var p3Span1:SpanElement = new SpanElement();
            var p3Span2:SpanElement = new SpanElement();
            var p3Span3:SpanElement = new SpanElement();
            p1Span1.text = "Breathe.";
            p1Span1.fontSize = fontSize;
            p1Span2.text = "Walk.";
            p1Span2.fontSize = fontSize + 1;
            p1Span3.text = "Play.";
            p1Span3.fontSize = fontSize + 2;
            p1.addChild(p1Span1);
            p1.addChild(p1Span2);
            p1.addChild(p1Span3);
            p2Span1.text = "Study.";
            p2Span1.fontSize = fontSize + 3;
            p2Span2.text = "Work.";
            p2Span2.fontSize = fontSize + 4;
            p2Span3.text = "Marry.";
            p2Span3.fontSize = fontSize + 5;
            p2.addChild(p2Span1);
            p2.addChild(p2Span2);
            p2.addChild(p2Span3);
            p3Span1.text = "Retire.";
            p3Span1.fontSize = fontSize + 6;
            p3Span2.text = "Travel.";
            p3Span2.fontSize = fontSize + 7;
            p3Span3.text = "Rock.";
            p3Span3.fontSize = fontSize + 8;
            p3.addChild(p3Span1);
            p3.addChild(p3Span2);
            p3.addChild(p3Span3);
            textFlow.addChild(p1);
            textFlow.addChild(p2);
            textFlow.addChild(p3);
            textFlow.flowComposer.addController(new ContainerController(this,600,600));
            textFlow.flowComposer.updateAllControllers();
            var leaf:SpanElement = new SpanElement();
            leaf = SpanElement(textFlow.getLastLeaf());
            trace(leaf.text);
            while(leaf = SpanElement(leaf.getPreviousLeaf(p3)))
                trace(leaf.text);
        }
    }
}