| Package | flashx.textLayout.elements |
| Class | public class SpanElement |
| Inheritance | SpanElement FlowLeafElement FlowElement Object |
| Subclasses | SpecialCharacterElement |
| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
A ParagraphElement will have a single SpanElement object if all the text in the paragraph shares the same set of attributes. It has multiple SpanElement objects if the text in the paragraph has multiple formats.
Default MXML PropertymxmlChildren
See also
| Property | Defined By | ||
|---|---|---|---|
![]() | alignmentBaseline : 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 | |
![]() | baselineShift : Object [write-only] CharacterFormat:
Amount to shift the baseline from the elementBaseline. | FlowElement | |
![]() | breakOpportunity : String [write-only] CharacterFormat:
Controls where lines are allowed to break when wrapping text is broken into multiple lines. | FlowElement | |
![]() | cffHinting : String [write-only] CharacterFormat:
The type of CFF hinting used for this text. | FlowElement | |
![]() | characterFormat : ICharacterFormat CharacterFormat properties applied directly to this element. | FlowElement | |
![]() | color : 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 | |
![]() | constructor : Object A reference to the class object or constructor function for a given object instance. | Object | |
![]() | digitCase : String [write-only] CharacterFormat:
The type of digit case used for this text. | FlowElement | |
![]() | digitWidth : String [write-only] CharacterFormat:
Type of digit width used for this text. | FlowElement | |
![]() | dominantBaseline : 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 | |
![]() | fontFamily : String [write-only] CharacterFormat:
The name of the font to use, or a comma-separated list of font names. | FlowElement | |
![]() | fontLookup : String [write-only] CharacterFormat:
Font lookup to use. | FlowElement | |
![]() | fontSize : Object [write-only] CharacterFormat:
The size of the text in pixels. | FlowElement | |
![]() | fontStyle : String [write-only] CharacterFormat:
Style of text. | FlowElement | |
![]() | fontWeight : String [write-only] CharacterFormat:
Weight of text. | FlowElement | |
![]() | kerning : String [write-only] CharacterFormat:
Kerning adjusts the pixels between certain character pairs to improve readability. | FlowElement | |
![]() | ligatureLevel : String [write-only] CharacterFormat:
Controls which of the ligatures that are defined in the font may be used in the text. | FlowElement | |
![]() | lineHeight : Object [write-only] CharacterFormat:
Leading controls for the text. | FlowElement | |
![]() | lineThrough : Object [write-only] CharacterFormat:
Strikethrough. | FlowElement | |
![]() | locale : String [write-only] CharacterFormat:
The locale of the text. | FlowElement | |
| mxmlChildren : Array [write-only] Sets text based on content within span tags. | SpanElement | ||
![]() | 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 : String [write-only] CharacterFormat:
The rendering mode used for this text. | FlowElement | |
| text : String Receives the String of text that this SpanElement object holds. | SpanElement | ||
![]() | textAlpha : Object [write-only] CharacterFormat:
Alpha (transparency) value for the text. | FlowElement | |
![]() | textDecoration : String [write-only] CharacterFormat:
Decoration on text. | FlowElement | |
![]() | textLength : int [read-only] Returns the total length of text owned by this FlowElement object and its children. | FlowElement | |
![]() | textRotation : String [write-only] CharacterFormat:
Determines the amount of degrees to rotate this text. | FlowElement | |
![]() | tracking : Object [write-only] Sets the tracking and is synonymous with the trackingRight property. | FlowElement | |
![]() | trackingLeft : 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 | |
![]() | trackingRight : 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 | |
![]() | typographicCase : String [write-only] CharacterFormat:
The type of typographic case used for this text. | FlowElement | |
![]() | whiteSpaceCollapse : String [write-only] CharacterFormat:
The setting used to collapse or preserve whitespace when importing text into a TextFlow. | FlowElement | |
| Method | Defined By | ||
|---|---|---|---|
Constructor - creates a SpanElement object to hold a run of text in a paragraph. | SpanElement | ||
![]() | 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 | |
![]() | Returns the start location of the element in the text flow as an absolute index. | FlowElement | |
![]() | Returns the ContainerFormattedElement that specifies its containers for filling. | 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 FontMetrics object for the span's character format (CharacterFormat). | FlowLeafElement | |
![]() | Returns the start of this element relative to an ancestor element. | FlowElement | |
![]() | Returns the next FlowLeafElement object. | FlowLeafElement | |
![]() | Returns the next FlowElement sibling in the text flow hierarchy. | FlowElement | |
![]() | Returns the ParagraphElement object associated with this element. | FlowElement | |
![]() | Returns the previous FlowLeafElement object. | FlowLeafElement | |
![]() | Returns the previous FlowElement sibling in the text flow hierarchy. | FlowElement | |
![]() | 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 | |
![]() | 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 | |
Updates the text in text span based on the specified start and end positions. | SpanElement | ||
![]() | Sets the availability of a dynamic property for loop operations. | Object | |
![]() | Makes a copy of the content of this FlowElement object that occurs between two character positions. | FlowElement | |
Splits this SpanElement object at the specified position and returns a new SpanElement object for the content
that follows the specified position. | SpanElement | ||
![]() | Returns the string representation of the specified object. | Object | |
![]() | Returns the primitive value of the specified object. | Object | |
| mxmlChildren | property |
mxmlChildren:Array [write-only] | Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Sets text based on content within span tags. This function is intended for use during mxml compiled import.
public function set mxmlChildren(value:Array):voidTypeError — if array element is not a SpecialCharacterElement or a String |
| text | property |
text:String [read-write] | Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Receives the String of text that this SpanElement object holds.
The text of a span does not include the carriage return (CR) at the end of the paragraph
but it is included in the value of
textLength
.
public function get text():String public function set text(value:String):void| SpanElement | () | Constructor |
public function SpanElement()| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Constructor - creates a SpanElement object to hold a run of text in a paragraph.
package {
import flash.display.Sprite;
import flash.text.engine.FontPosture;
import flashx.textLayout.container.DisplayObjectContainerController;
import flashx.textLayout.container.IContainerController;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.CharacterFormat;
import flashx.textLayout.edit.EditManager;
public class SpanElementExample extends Sprite
{
public function SpanElementExample()
{
var textFlow:TextFlow = new TextFlow();
var editManager:EditManager = new EditManager();
var p:ParagraphElement = new ParagraphElement();
var spanHello:SpanElement = new SpanElement();
var spanWorld:SpanElement = new SpanElement();
spanHello.text = "Hello, ";
spanHello.fontSize = 48;
spanWorld.text = "World!";
spanWorld.fontSize = 56;
spanWorld.fontStyle = FontPosture.ITALIC;
p.addChild(spanHello);
p.addChild(spanWorld);
textFlow.interactionManager = editManager;
textFlow.addChild(p);
textFlow.flowComposer.addController(new DisplayObjectContainerController(this,400,200));
textFlow.flowComposer.updateAllContainers();
}
}
}| replaceText | () | method |
public function replaceText(relativeStartPosition:int, relativeEndPosition:int, textValue:String):void| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Updates the text in text span based on the specified start and end positions. To insert text, set the end position equal to the start position. To append text to the existing text in the span, set the start position and the end position equal to the length of the existing text.
The replaced text includes the start character and up to but not including the end character.
Parameters
relativeStartPosition:int — The index position of the beginning of the text to be replaced,
relative to the start of the span. The first character in the span is at position 0. | |
relativeEndPosition:int —
The index one position after the last character of the text to be replaced,
relative to the start of the span. Set this value equal to
relativeStartPos
for an insert.
| |
textValue:String — The replacement text or the text to add, as the case may be. |
RangeError —
The
relativeStartPosition
or
relativeEndPosition
specified is out of
range or a surrogate pair is being split as a result of the replace.
|
| splitAtPosition | () | method |
public function splitAtPosition(relativePosition:int):SpanElement| Language Version: | ActionScript 3.0 |
| Runtime Versions: | Flash Player 10, AIR 1.5 |
Splits this SpanElement object at the specified position and returns a new SpanElement object for the content that follows the specified position.
This method throws an error if you attempt to split a surrogate pair. In Unicode UTF-16, a surrogate pair is a pair of 16-bit code units (a high code unit and a low code unit) that represent one of the abstract Unicode characters that cannot be represented in a single 16-bit word. The 16-bit high code unit is in the range of D800 to DBFF. The 16-bit low code unit is in the range of DC00 to DFFF.
Parameters
relativePosition:int — - relative position in the span to create the split |
SpanElement — - the newly created span. |
RangeError —
relativePosition
is less than 0 or greater than textLength or a surrogate pair is being split.
|
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/SpanElement.html