Adobe® Flex® 4 Language Reference
Show Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
flash.text.engine 
ContentElement 
Packageflash.text.engine
Classpublic class ContentElement
InheritanceContentElement Inheritance Object
Subclasses GraphicElement, GroupElement, TextElement

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

The ContentElement class serves as a base class for the element types that can appear in a GroupElement, namely a GraphicElement, another GroupElement, or a TextElement.

ContentElement is an abstract base class; therefore, you cannot instantiate ContentElement directly. Invoking new ContentElement() throws an ArgumentError exception.

You can assign a ContentElement element to exactly one GroupElement or to the content property of exactly one text block.

See also



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  elementFormat : ElementFormat
The ElementFormat object used for the element.
ContentElement
  eventMirror : EventDispatcher
The EventDispatcher object that receives copies of every event dispatched to valid text lines based on this content element.
ContentElement
  groupElement : GroupElement
[read-only] The GroupElement object that contains this element, or null if it is not in a group.
ContentElement
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  rawText : String
[read-only] A copy of the text in the element, including any U+FDEF characters.
ContentElement
  text : String
[read-only] A copy of the text in the element, not including any U+FDEF characters, which represent graphic elements in the String.
ContentElement
  textBlock : flash.text.engine:TextBlock
[read-only] The TextBlock to which this element belongs.
ContentElement
  textBlockBeginIndex : int
[read-only] The index in the text block of the first character of this element.
ContentElement
  textRotation : String
The rotation to apply to the element as a unit.
ContentElement
  userData : *
Provides a way for an application to associate arbitrary data with the element.
ContentElement
Public Methods
 MethodDefined By
  
ContentElement(elementFormat:ElementFormat = null, eventMirror:EventDispatcher = null, textRotation:String = "rotate0")
Calling the new ContentElement() constructor throws an ArgumentError exception.
ContentElement
 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
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
Public Constants
 ConstantDefined By
  GRAPHIC_ELEMENT : uint = 0xFDEF
[static] Indicates the presence of a graphic element in the text.
ContentElement
Property Detail

elementFormat

property
elementFormat:ElementFormat

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

The ElementFormat object used for the element.

The default value is null.

When the elementFormat property is set, the ElementFormat object provided is locked: its locked property is set to true. A locked ElementFormat cannot be modified.



Implementation
    public function get elementFormat():ElementFormat
    public function set elementFormat(value:ElementFormat):void

See also

eventMirror

property 
eventMirror:EventDispatcher

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

The EventDispatcher object that receives copies of every event dispatched to valid text lines based on this content element. The specified object can be used to set up listeners for a text link or other interactive piece of text, as it can be difficult to determine at runtime which parts of lines have resulted from particular content elements. You can also use listeners to apply decorations such as underlines, the metrics of which you cannot determine until after the text is laid out. The default value is null, which means no mirrored events are dispatched.

Event mirrors manifest themselves in text lines as instances of the TextLineMirrorRegion class. Depending on bidirectional processing and line breaking, one or more mirror regions can be produced.

The default value is null.



Implementation
    public function get eventMirror():EventDispatcher
    public function set eventMirror(value:EventDispatcher):void

See also

groupElement

property 
groupElement:GroupElement  [read-only]

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

The GroupElement object that contains this element, or null if it is not in a group.

The default value is null.



Implementation
    public function get groupElement():GroupElement

See also

rawText

property 
rawText:String  [read-only]

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

A copy of the text in the element, including any U+FDEF characters. The Unicode character, U+FDEF, marks the location of a graphic element in the String.



Implementation
    public function get rawText():String

text

property 
text:String  [read-only]

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

A copy of the text in the element, not including any U+FDEF characters, which represent graphic elements in the String.



Implementation
    public function get text():String

See also

textBlock

property 
textBlock:flash.text.engine:TextBlock  [read-only]

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

The TextBlock to which this element belongs.

The default value is null.



Implementation
    public function get textBlock():flash.text.engine:TextBlock

See also

textBlockBeginIndex

property 
textBlockBeginIndex:int  [read-only]

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

The index in the text block of the first character of this element. This value is not cached; it is calculated whenever this method is called.

The default value is -1.



Implementation
    public function get textBlockBeginIndex():int

textRotation

property 
textRotation:String

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

The rotation to apply to the element as a unit. Use TextRotation constants for this property.

The default value is TextRotation.ROTATE_0.

The final rotation of any glyph is the sum of ElementFormat.textRotation, ContentElement.textRotation, and TextBlock.lineRotation.

ContentElement.textRotation is used to create a short run of text whose rotation differs from the containing line. TCY runs in Japanese text are an example. TCY stands for Tate-Chu-Yoko and refers to a little horizontal run of text (usually a number) in some vertical Japanese text. To create a Paragraph of vertical Japanese text containing a TCY run, do the following:

  1. Set TextBlock.lineRotation=TextRotation.ROTATE_90
  2. Set TextBlock.content to a GroupElement, consisting of three TextElement objects. The first of these elements is the Japanese text before the TCY run, the second is the Latin text of the TCY run, and the third is the Japanese text after the TCY run.
  3. Set the textRotation property of the TCY TextElement to TextRotation.ROTATE_270. The TCY text element rotates as a unit. It starts with a 90 degree rotation inherited from the line. Adding another 270 degrees takes it around to horizontal.

Rotated content elements cannot be nested. In any hierarchy of content elements, no matter how complex, only one content element can have its textRotation property set. The following methods and property setters throw an argument error if nested rotations are detected:

  1. ContentElement.textRotation
  2. GroupElement.setElements
  3. GroupElement.replaceElements

To set values for this property, use the following string values:

String valueDescription
TextRotation.ROTATE_0Element is not rotated.
TextRotation.ROTATE_90Element is rotated 90 degrees clockwise.
TextRotation.ROTATE_180Element is rotated 180 degrees.
TextRotation.ROTATE_270Element is rotated 270 degrees clockwise.
TextRotation.AUTONot supported.



Implementation
    public function get textRotation():String
    public function set textRotation(value:String):void

Throws
ArgumentError — If set to any value that is not a member of TextRotation.
 
ArgumentError — If set to TextRotation.AUTO.
 
ArgumentError — If the operation would result in nested rotations within a GroupElement.

See also

userData

property 
public var userData:*

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

Provides a way for an application to associate arbitrary data with the element.

The default value is null.

Constructor Detail

ContentElement

()Constructor
public function ContentElement(elementFormat:ElementFormat = null, eventMirror:EventDispatcher = null, textRotation:String = "rotate0")

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

Calling the new ContentElement() constructor throws an ArgumentError exception. You can, however, call constructors for the following subclasses of ContentElement:

  • new GraphicElement()
  • new GroupElement()
  • new TextElement()

Parameters
elementFormat:ElementFormat (default = null) — The element format for the text in the element. The default value is null.
 
eventMirror:EventDispatcher (default = null) — The EventDispatcher object that receives copies of every event dispatched to valid text lines created based on this content element. The default value is null.
 
textRotation:String (default = "rotate0") — The rotation applied the element as a unit. Use TextRotation constants for this property. The default value is TextRotation.ROTATE_0.
Constant Detail

GRAPHIC_ELEMENT

Constant
public static const GRAPHIC_ELEMENT:uint = 0xFDEF

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

Indicates the presence of a graphic element in the text.

See also