Package | flashx.textLayout.elements |
Class | public class FlowGroupElement |
Inheritance | FlowGroupElement FlowElement Object |
Subclasses | ParagraphFormattedElement, SubParagraphGroupElement |
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
You cannot create a FlowGroupElement object directly. Invoking new FlowGroupElement()
throws an error
exception.
Default MXML PropertymxmlChildren
See also
Property | Defined By | ||
---|---|---|---|
alignmentBaseline : *
TextLayoutFormat:
Specifies the baseline to which the dominant baseline aligns. | FlowElement | ||
backgroundAlpha : *
TextLayoutFormat:
Alpha (transparency) value for the background (adopts default value if undefined during cascade). | FlowElement | ||
backgroundColor : *
TextLayoutFormat:
Background color of the text (adopts default value if undefined during cascade). | FlowElement | ||
baselineShift : *
TextLayoutFormat:
Amount to shift the baseline from the dominantBaseline value. | FlowElement | ||
blockProgression : *
TextLayoutFormat:
Specifies a vertical or horizontal progression of line placement. | FlowElement | ||
breakOpportunity : *
TextLayoutFormat:
Controls where lines are allowed to break when breaking wrapping text into multiple lines. | FlowElement | ||
cffHinting : *
TextLayoutFormat:
The type of CFF hinting used for this text. | FlowElement | ||
color : *
TextLayoutFormat:
Color of the text. | FlowElement | ||
columnCount : *
TextLayoutFormat:
Number of text columns (adopts default value if undefined during cascade). | FlowElement | ||
columnGap : *
TextLayoutFormat:
Specifies the amount of gutter space, in pixels, to leave between the columns (adopts default value if undefined during cascade). | FlowElement | ||
columnWidth : *
TextLayoutFormat:
Column width in pixels (adopts default value if undefined during cascade). | FlowElement | ||
computedFormat : flashx.textLayout.formats:ITextLayoutFormat [read-only]
Returns the computed format attributes that are in effect for this element. | FlowElement | ||
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
coreStyles : Object [read-only] Returns the core styles on a FlowElement instance. | FlowElement | ||
digitCase : *
TextLayoutFormat:
The type of digit case used for this text. | FlowElement | ||
digitWidth : *
TextLayoutFormat:
Type of digit width used for this text. | FlowElement | ||
direction : *
TextLayoutFormat:
Specifies the default bidirectional embedding level of the text in the text block. | FlowElement | ||
dominantBaseline : *
TextLayoutFormat:
Specifies which element baseline snaps to the alignmentBaseline to determine the vertical position of the element on the line. | FlowElement | ||
firstBaselineOffset : *
TextLayoutFormat:
Specifies the baseline position of the first line in the container. | FlowElement | ||
fontFamily : *
TextLayoutFormat:
The name of the font to use, or a comma-separated list of font names. | FlowElement | ||
fontLookup : *
TextLayoutFormat:
Font lookup to use. | FlowElement | ||
fontSize : *
TextLayoutFormat:
The size of the text in pixels. | FlowElement | ||
fontStyle : *
TextLayoutFormat:
Style of text. | FlowElement | ||
fontWeight : *
TextLayoutFormat:
Weight of text. | FlowElement | ||
format : flashx.textLayout.formats:ITextLayoutFormat TextLayoutFormat properties applied directly to this element. | FlowElement | ||
id : String
Assigns an identifying name to the element, making it possible to set a style for the element
by referencing the id. | FlowElement | ||
justificationRule : *
TextLayoutFormat:
Rule used to justify text in a paragraph. | FlowElement | ||
justificationStyle : *
TextLayoutFormat:
The style used for justification of the paragraph. | FlowElement | ||
kerning : *
TextLayoutFormat:
Kerning adjusts the pixels between certain character pairs to improve readability. | FlowElement | ||
leadingModel : *
TextLayoutFormat:
Specifies the leading model, which is a combination of leading basis and leading direction. | FlowElement | ||
ligatureLevel : *
TextLayoutFormat:
Controls which of the ligatures that are defined in the font may be used in the text. | FlowElement | ||
lineBreak : *
TextLayoutFormat:
Controls word wrapping within the container (adopts default value if undefined during cascade). | FlowElement | ||
lineHeight : *
TextLayoutFormat:
Leading controls for the text. | FlowElement | ||
lineThrough : *
TextLayoutFormat:
If true, applies strikethrough, a line drawn through the middle of the text. | FlowElement | ||
linkActiveFormat : * Defines the formatting attributes used for links in active state, when the mouse is down on a link. | FlowElement | ||
linkHoverFormat : * Defines the formatting attributes used for links in hover state, when the mouse is within the bounds (rolling over) a link. | FlowElement | ||
linkNormalFormat : * Defines the formatting attributes used for links in normal state. | FlowElement | ||
locale : *
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 | ||
paddingBottom : *
TextLayoutFormat:
Botttom inset in pixels (adopts default value if undefined during cascade). | FlowElement | ||
paddingLeft : *
TextLayoutFormat:
Left inset in pixels (adopts default value if undefined during cascade). | FlowElement | ||
paddingRight : *
TextLayoutFormat:
Right inset in pixels (adopts default value if undefined during cascade). | FlowElement | ||
paddingTop : *
TextLayoutFormat:
Top inset in pixels (adopts default value if undefined during cascade). | FlowElement | ||
paragraphEndIndent : *
TextLayoutFormat:
A Number that specifies, in pixels, the amount to indent the paragraph's end edge. | FlowElement | ||
paragraphSpaceAfter : *
TextLayoutFormat:
A Number that specifies the amount of space, in pixels, to leave after the paragraph. | FlowElement | ||
paragraphSpaceBefore : *
TextLayoutFormat:
A Number that specifies the amount of space, in pixels, to leave before the paragraph. | FlowElement | ||
paragraphStartIndent : *
TextLayoutFormat:
A Number that specifies, in pixels, the amount to indent the paragraph's start edge. | FlowElement | ||
parent : FlowGroupElement [read-only] Returns the parent of this FlowElement object. | FlowElement | ||
parentRelativeEnd : int [read-only] Returns the relative end of this FlowElement object in the parent. | FlowElement | ||
parentRelativeStart : int [read-only] Returns the relative start of this FlowElement object in the parent. | FlowElement | ||
prototype : Object [static]
A reference to the prototype object of a class or function object. | Object | ||
renderingMode : *
TextLayoutFormat:
The rendering mode used for this text. | FlowElement | ||
styleName : String
Assigns an identifying class to the element, making it possible to set a style for the element
by referencing the styleName. | FlowElement | ||
tabStops : *
TextLayoutFormat:
Specifies the tab stops associated with the paragraph. | FlowElement | ||
textAlign : *
TextLayoutFormat:
Alignment of lines in the paragraph relative to the container. | FlowElement | ||
textAlignLast : *
TextLayoutFormat:
Alignment of the last (or only) line in the paragraph relative to the container in justified text. | FlowElement | ||
textAlpha : *
TextLayoutFormat:
Alpha (transparency) value for the text. | FlowElement | ||
textDecoration : *
TextLayoutFormat:
Decoration on text. | FlowElement | ||
textIndent : *
TextLayoutFormat:
A Number that specifies, in pixels, the amount to indent the first line of the paragraph. | FlowElement | ||
textJustify : *
TextLayoutFormat:
Specifies options for justifying text. | FlowElement | ||
textLength : int [read-only]
Returns the total length of text owned by this FlowElement object and its children. | FlowElement | ||
textRotation : *
TextLayoutFormat:
Determines the number of degrees to rotate this text. | FlowElement | ||
tracking : Object [write-only]
Sets the tracking and is synonymous with the trackingRight property. | FlowElement | ||
trackingLeft : *
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 | ||
trackingRight : *
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 | ||
typographicCase : *
TextLayoutFormat:
The type of typographic case used for this text. | FlowElement | ||
userStyles : Object Allows you to read and write user styles on a FlowElement object. | FlowElement | ||
verticalAlign : *
TextLayoutFormat:
Vertical alignment or justification (adopts default value if undefined during cascade). | FlowElement | ||
whiteSpaceCollapse : *
TextLayoutFormat:
Collapses or preserves whitespace when importing text into a TextFlow. | FlowElement |
Method | Defined 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 | ||
Clears the style specified by the styleProp parameter from this FlowElement object. | 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 | ||
Compare the userStyles of this with otherElement's userStyles. | FlowElement | ||
Given a relative text position, find the index of the first child FlowElement that contains the relative position. | FlowGroupElement | ||
Given a relative text position, find the leaf element that contains the position. | FlowGroupElement | ||
Returns the start location of the element in the text flow as an absolute index. | FlowElement | ||
Returns the character at the specified position, relative to this FlowElement object. | FlowElement | ||
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 | ||
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 | ||
Returns the next FlowElement sibling in the text flow hierarchy. | FlowElement | ||
Returns the ParagraphElement object associated with this element. | FlowElement | ||
Returns the previous FlowElement sibling in the text flow hierarchy. | FlowElement | ||
Returns the value of the style specified by the styleProp parameter, which specifies
the style name and can include any user style name. | FlowElement | ||
[override] | FlowGroupElement | ||
Climbs the text flow hierarchy to return the root TextFlow object for the element. | FlowElement | ||
Indicates whether an object has a specified property defined. | Object | ||
Called for MXML objects after the implementing object has been created and all component properties specified on the MXML tag have been initialized. | FlowElement | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Removes the specified child FlowElement object from the group. | FlowGroupElement | ||
Removes the child FlowElement object at the specified index position. | FlowGroupElement | ||
Replaces child elements in the group with the specified new elements. | FlowGroupElement | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Sets the style specified by the styleProp parameter to the value specified by the
newValue parameter. | 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 | ||
Splits this FlowElement object at the position specified by the relativePosition parameter, which is
a relative position in the text for this element. | FlowElement | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Returns the primitive value of the specified object. | Object |
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
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.
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.
|
FlowElement — the added child FlowElement
|
Example ( How to use this example )
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.
|
FlowElement — the added child FlowElement
|
Throws
RangeError — The index is out of range.
|
Example ( How to use this example )
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
|
int — index of first child element containing relativePosition
|
Example ( How to use this example )
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.
|
FlowLeafElement — the leaf element containing the relative position.
|
Example ( How to use this example )
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.
|
FlowElement — the child FlowElement object at the specified position.
|
Example ( How to use this example )
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.
|
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.
ReturnsFlowLeafElement — the first FlowLeafElement object.
|
Example ( How to use this example )
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.
ReturnsFlowLeafElement — the last FlowLeafElement object.
|
Example ( How to use this example )
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 = " ")
|
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.
|
FlowElement — the removed child FlowElement object
|
Throws
ArgumentError — The child is not found.
|
Example ( How to use this example )
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.
|
FlowElement — the child FlowElement object removed from the specified position.
|
Throws
RangeError — The index is out of range.
|
Example ( How to use this example )
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
andendChildIndex
. The new elements is inserted before the specified index. - To append elements, pass
numChildren
forbeginChildIndex
andendChildIndex
.
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 )
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 |
FlowGroupElement — the new FlowGroupElement object.
|
Throws
RangeError — if childIndex is greater than the length of the children.
|
Thu May 20 2010, 02:19 AM -07:00