ActionScript 3.0 Language and Components Reference | All Packages | All Classes | Language Elements | Index | Appendixes | Conventions | Frames No Frames |
ContentElement

Package | flash.text.engine
Class | public class ContentElement
Inheritance | ContentElement Object
Subclasses | GraphicElement, GroupElement, TextElement

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

The ContentElement class serves as a base class for the various 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.

A ContentElement can be in exactly one `GroupElement` or specified as the `content` of exactly one text block.

See also

ElementFormat
GraphicElement
GroupElement
TextBlock.content
TextElement
TextLineMirrorRegion
TextRotation

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | elementFormat : ElementFormat The ElementFormat used for the element. | ContentElement
|  | eventMirror : EventDispatcher The EventDispatcher object that receives copies of every event dispatched to text lines based on this content element. | ContentElement
|  | groupElement : GroupElement [read-only] The GroupElement which contains this element, or null if it is not in a group. | ContentElement
|  | prototype : 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 the U+FDEF characters representing graphic elements. | ContentElement
|  | text : String [read-only] A copy of the text in the element, not including the U+FDEF characters representing graphic elements. | ContentElement
|  | textBlock : 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 the author to associate arbitrary data with the element. | ContentElement

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | ContentElement(elementFormat:ElementFormat = null, eventMirror:EventDispatcher = null, textRotation:String = "rotate0") Calling the new ContentElement() constructor throws an ArgumentError exception. | ContentElement
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Public Constants

| Constant | Defined By
--- | --- | ---
|  | GRAPHIC_ELEMENT : uint = 0xFDEF [static] Used to indicate the presence a graphic element in the text. | ContentElement

Property Detail

elementFormat | property

`elementFormat:ElementFormat` [read-write]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

The ElementFormat used for the element.

The default value is `null`.

Changing the properties of an ElementFormat object that has been applied to a TextElement does not invalidate the corresponding lines in a text block to which the TextElement belongs. Directly setting the ElementFormat object of the TextElement does invalidate those lines.

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

See also

ElementFormat
TextBlock
TextElement

eventMirror | property |

`eventMirror:EventDispatcher` [read-write]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

The `EventDispatcher` object that receives copies of every event dispatched to 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 which lines have resulted from which 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 will be 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

flash.events.EventDispatcher
TextElement.eventMirror
TextLineMirrorRegion

groupElement | property |

`groupElement:GroupElement` [read-only]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 9

The GroupElement which 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

GroupElement

rawText | property |

`rawText:String` [read-only]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

A copy of the text in the element, including the U+FDEF characters representing graphic elements.

Implementation
`public function get rawText():String`

text | property |

`text:String` [read-only]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

A copy of the text in the element, not including the U+FDEF characters representing graphic elements.

Implementation
`public function get text():String`

See also

TextElement.text

textBlock | property |

`textBlock:TextBlock` [read-only]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 9

The TextBlock to which this element belongs.

The default value is `null`.

Implementation
`public function get textBlock():TextBlock`

See also

TextBlock

textBlockBeginIndex | property |

`textBlockBeginIndex:int` [read-only]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 9

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

The default value is 0.

Implementation
`public function get textBlockBeginIndex():int`

textRotation | property |

`textRotation:String` [read-write]

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

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 TextBlock.glyphRotation, 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. To create a Paragraph of vertical Japanese text containing a TCY run, do the following:

1. Set `TextBlock.glyphRotation=GlyphRotation.FULL_AND_WIDE`
2. Set `TextBlock.lineRotation=TextRotation.ROTATE_90`
3. 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.
4. 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 value | Description
--- | ---
`TextRotation.ROTATE_0` | Element is not rotated.
`TextRotation.ROTATE_90` | Element is rotated 90 degrees clockwise.
`TextRotation.ROTATE_180` | Element is rotated 180 degrees.
`TextRotation.ROTATE_270` | Element is rotated 270 degrees clockwise.

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

| `ArgumentError` — If set to any value which is not a member of `TextRotation`.
| `ArgumentError` — If the operation would result in nested rotations within a `GroupElement`.

See also

TextRotation
ElementFormat.textRotation
TextBlock.glyphRotation
TextBlock.lineRotation

userData | property |

`public var userData:*`

Language Version : | ActionScript 3.0

Player Version : | Flash Player 10

Provides a way for the author 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

Player Version : | Flash Player 10

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 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

Player Version : | Flash Player 10

Used to indicate the presence a graphic element in the text.

See also

GraphicElement

Submit Feedback on LiveDocs
© 2004-2008 Adobe Systems Incorporated. All rights reserved.
Tue May 20 2008, 04:02 AM -07:00