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.

See also

InlineGraphicElement
SpanElement


Public Properties
 PropertyDefined By
 InheritedalignmentBaseline : String
[write-only] CharacterFormat: Specifies the line baseline to which the element baseline specified by the elementBaseline property should align to determine the vertical position of the element on the line.
FlowElement
 InheritedbaselineShift : Object
[write-only] CharacterFormat: Amount to shift the baseline from the elementBaseline.
FlowElement
 InheritedbreakOpportunity : String
[write-only] CharacterFormat: Controls where lines are allowed to break when wrapping text is broken into multiple lines.
FlowElement
 InheritedcffHinting : String
[write-only] CharacterFormat: The type of CFF hinting used for this text.
FlowElement
 InheritedcharacterFormat : ICharacterFormat
CharacterFormat properties applied directly to this element.
FlowElement
 Inheritedcolor : Object
[write-only] CharacterFormat: Color of the text.
FlowElement
  computedCharacterFormat : ICharacterFormat
[read-only] Returns the computed character 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
 InheriteddigitCase : String
[write-only] CharacterFormat: The type of digit case used for this text.
FlowElement
 InheriteddigitWidth : String
[write-only] CharacterFormat: Type of digit width used for this text.
FlowElement
 InheriteddominantBaseline : String
[write-only] CharacterFormat: Specifies which of the baselines of the element snaps to the alignmentBaseline to determine the vertical position of the element on the line.
FlowElement
 InheritedfontFamily : String
[write-only] CharacterFormat: The name of the font to use, or a comma-separated list of font names.
FlowElement
 InheritedfontLookup : String
[write-only] CharacterFormat: Font lookup to use.
FlowElement
 InheritedfontSize : Object
[write-only] CharacterFormat: The size of the text in pixels.
FlowElement
 InheritedfontStyle : String
[write-only] CharacterFormat: Style of text.
FlowElement
 InheritedfontWeight : String
[write-only] CharacterFormat: Weight of text.
FlowElement
 Inheritedkerning : String
[write-only] CharacterFormat: Kerning adjusts the pixels between certain character pairs to improve readability.
FlowElement
 InheritedligatureLevel : String
[write-only] CharacterFormat: Controls which of the ligatures that are defined in the font may be used in the text.
FlowElement
 InheritedlineHeight : Object
[write-only] CharacterFormat: Leading controls for the text.
FlowElement
 InheritedlineThrough : Object
[write-only] CharacterFormat: Strikethrough.
FlowElement
 Inheritedlocale : String
[write-only] CharacterFormat: The locale of the text.
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 : String
[write-only] CharacterFormat: The rendering mode used for this text.
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
 InheritedtextAlpha : Object
[write-only] CharacterFormat: Alpha (transparency) value for the text.
FlowElement
 InheritedtextDecoration : String
[write-only] CharacterFormat: Decoration on text.
FlowElement
 InheritedtextLength : int
[read-only] Returns the total length of text owned by this FlowElement object and its children.
FlowElement
 InheritedtextRotation : String
[write-only] CharacterFormat: Determines the amount of degrees to rotate this text.
FlowElement
 Inheritedtracking : Object
[write-only] Sets the tracking and is synonymous with the trackingRight property.
FlowElement
 InheritedtrackingLeft : Object
[write-only] CharacterFormat: 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 : Object
[write-only] CharacterFormat: 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 : String
[write-only] CharacterFormat: The type of typographic case used for this text.
FlowElement
 InheritedwhiteSpaceCollapse : String
[write-only] CharacterFormat: The setting used to collapse or preserve whitespace when importing text into a TextFlow.
FlowElement
Protected Properties
 PropertyDefined By
  eventMirror : EventDispatcher
[read-only] Gets the EventDispatcher associated with this FlowLeafElement.
FlowLeafElement
Public Methods
 MethodDefined By
 Inherited
deepCopy(relativeStart:int = 0, relativeEnd:int = -1):FlowElement
Makes a deep copy of the portion of a FlowElement object between two character positions, including any children, and returns it as a FlowElement object.
FlowElement
 Inherited
Returns the start location of the element in the text flow as an absolute index.
FlowElement
 Inherited
Returns the ContainerFormattedElement that specifies its containers for filling.
FlowElement
 Inherited
Returns the character at the specified position, relative to this FlowElement object.
FlowElement
 Inherited
Returns the character code at the specified position, relative to this FlowElement.
FlowElement
  
Returns the FontMetrics object for the span's character format (CharacterFormat).
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
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
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
shallowCopy(relativeStart:int = 0, relativeEnd:int = -1):FlowElement
Makes a copy of the content of this FlowElement object that occurs between two character positions.
FlowElement
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail
computedCharacterFormatproperty
computedCharacterFormat:ICharacterFormat  [read-only]

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

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



Implementation
    public function get computedCharacterFormat():ICharacterFormat

See also

eventMirrorproperty 
eventMirror:EventDispatcher  [read-only]

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

Gets the EventDispatcher associated with this FlowLeafElement. Use the functions of EventDispatcher such as setEventHandler() and removeEventHandler() to capture events that happen over this FlowLeafElement object. The event handler that you specify will be called after this FlowLeafElement object does the processing it needs to do.



Implementation
    protected function get eventMirror():EventDispatcher

See also

textproperty 
text:String  [read-only]

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

The text associated with the FlowLeafElement:



Implementation
    public function get text():String

See also

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's character format (CharacterFormat). 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

See also

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

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 {
    
    import flash.display.Sprite;
    import flashx.textLayout.elements.TextFlow;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.container.IContainerController;
    import flashx.textLayout.container.DisplayObjectContainerController;
    
    public class FlowLeafElement_getNextLeafExample extends Sprite{    
        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 DisplayObjectContainerController(this,600,600));
            textFlow.flowComposer.updateAllContainers();
            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

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 {
    
    import flash.display.Sprite;
    import flashx.textLayout.elements.TextFlow;
    import flashx.textLayout.elements.SpanElement;
    import flashx.textLayout.elements.ParagraphElement;
    import flashx.textLayout.container.IContainerController;
    import flashx.textLayout.container.DisplayObjectContainerController;
    
    
    public class FlowLeafElement_getPreviousLeafExample extends Sprite{    
        var textFlow:TextFlow = new TextFlow();

        public function FlowLeafElement_getPreviousLeafExample(){
            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.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 DisplayObjectContainerController(this,600,600));
            textFlow.flowComposer.updateAllContainers();
            var leaf:SpanElement = new SpanElement();
            leaf = SpanElement(textFlow.getLastLeaf());
            trace(leaf.text);
            while(leaf = SpanElement(leaf.getPreviousLeaf(p3)))
                trace(leaf.text);
        }
    }
}




 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/labs/textlayout/flashx/textLayout/elements/FlowLeafElement.html