Package | flash.text.engine |
Class | public class ContentElement |
Inheritance | ContentElement Object |
Subclasses | GraphicElement, GroupElement, TextElement |
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
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
Property | Defined By | ||
---|---|---|---|
constructor : 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 | ||
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. | ContentElement | ||
text : String [read-only]
A copy of the text in the element, not including the 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 the author to associate arbitrary data with the element. | ContentElement |
Method | Defined By | ||
---|---|---|---|
ContentElement(elementFormat:ElementFormat = null, eventMirror:EventDispatcher = null, textRotation:String = "rotate0")
Calling the new ContentElement() constructor throws an
ArgumentError exception. | ContentElement | ||
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 | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
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 |
Constant | Defined By | ||
---|---|---|---|
GRAPHIC_ELEMENT : uint = 0xFDEF [static]
Indicates the presence a graphic element in the text. | ContentElement |
elementFormat | property |
elementFormat:ElementFormat
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
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 |
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 |
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 |
A copy of the text in the element, including the U+FDEF characters. The U+FDEF character is an arbitrary character that represents 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 |
A copy of the text in the element, not including the 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 |
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 |
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 |
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:
- Set
TextBlock.lineRotation=TextRotation.ROTATE_90
- Set
TextBlock.content
to aGroupElement
, consisting of threeTextElement
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. - Set the
textRotation
property of the TCYTextElement
toTextRotation.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:
ContentElement.textRotation
GroupElement.setElements
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. |
TextRotation.AUTO | Not 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 |
Provides a way for the author to associate arbitrary data with the element.
The default value is null
.
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 |
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()
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 .
|
GRAPHIC_ELEMENT | Constant |
public static const GRAPHIC_ELEMENT:uint = 0xFDEF
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Indicates the presence a graphic element in the text.
See also
Fri Mar 19 2010, 02:45 AM -07:00