flashx.textLayout.elements

# LinkElement - AS3

Package | flashx.textLayout.elements
Class | public final class LinkElement
Inheritance | LinkElement SubParagraphGroupElementBase FlowGroupElement FlowElement Object
Implements | IEventDispatcher

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

The LinkElement class is a subclass of the SubParagraphGroupElementBase class and it can contain one or more FlowElement objects, such as a SpanElement object that stores the link text. An empty LinkElement, which does not contain a FlowElement object, is ignored.

Normally when clicked the LinkElement will call the `flash.net.navigateToURL()` method. A special URI scheme `event:` is also supported. This scheme will generate a TextFlow event that the user may listen to in order to execute AS3 code. An example is included below.

If you specify a target, it must be one of the following values:

Target value | description
--- | ---
_self | Replaces the current HTML page. If it is in a frame or frameset, it will load within that frame. If it is the full browser, it opens to replace the page from which it came.
_blank | Opens a new browser name with no name.
_parent | Replaces the HTML page from which it came.
_top | Loads in the current browser, replacing anything within it, such as a frameset.

Default MXML Property `mxmlChildren`

View the examples

More examples

Creating TextFlow objects
Adding hyperlinks with TLF

Related API Elements

LinkState
FlowElement.linkActiveFormat
FlowElement.linkHoverFormat
FlowElement.linkNormalFormat
TextFlow

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| 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
|  | clearFloats : * TextLayoutFormat: Controls how text wraps around a float. | 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 coreStyles on this FlowElement. | 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
|  | href : String The Uniform Resource Identifier (URI) associated with the LinkElement object. | LinkElement
|  | 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 : * TextLayoutFormat: Defines the formatting attributes used for links in normal state. | FlowElement
|  | linkHoverFormat : * TextLayoutFormat: Defines the formatting attributes used for links in hover state, when the mouse is within the bounds (rolling over) a link. | FlowElement
|  | linkNormalFormat : * TextLayoutFormat: Defines the formatting attributes used for links in normal state. | FlowElement
|  | linkState : String [read-only] The current state of the link. | LinkElement
|  | listAutoPadding : * TextLayoutFormat: This specifies an auto indent for the start edge of lists when the padding value of the list on that side is auto. | FlowElement
|  | listMarkerFormat : * TextLayoutFormat: Defines the formatting attributes list markers. | FlowElement
|  | listStylePosition : * TextLayoutFormat: Legal values are ListStylePosition.INSIDE, ListStylePosition.OUTSIDE, FormatValue.INHERIT. Default value is undefined indicating not set. If undefined during the cascade this property will inherit its value from an ancestor. | FlowElement
|  | listStyleType : * TextLayoutFormat: Legal values are ListStyleType.UPPER_ALPHA, ListStyleType.LOWER_ALPHA, ListStyleType.UPPER_ROMAN, ListStyleType.LOWER_ROMAN, ListStyleType.NONE, ListStyleType.DISC, ListStyleType.CIRCLE, ListStyleType.SQUARE, ListStyleType.BOX, ListStyleType.CHECK, ListStyleType.DIAMOND, ListStyleType.HYPHEN, ListStyleType.ARABIC_INDIC, ListStyleType.BENGALI, ListStyleType.DECIMAL, ListStyleType.DECIMAL_LEADING_ZERO, ListStyleType.DEVANAGARI, ListStyleType.GUJARATI, ListStyleType.GURMUKHI, ListStyleType.KANNADA, ListStyleType.PERSIAN, ListStyleType.THAI, ListStyleType.URDU, ListStyleType.CJK_EARTHLY_BRANCH, ListStyleType.CJK_HEAVENLY_STEM, ListStyleType.HANGUL, ListStyleType.HANGUL_CONSTANT, ListStyleType.HIRAGANA, ListStyleType.HIRAGANA_IROHA, ListStyleType.KATAKANA, ListStyleType.KATAKANA_IROHA, ListStyleType.LOWER_ALPHA, ListStyleType.LOWER_GREEK, ListStyleType.LOWER_LATIN, ListStyleType.UPPER_ALPHA, ListStyleType.UPPER_GREEK, ListStyleType.UPPER_LATIN, FormatValue.INHERIT. Default value is undefined indicating not set. If undefined during the cascade this property will inherit its value from an ancestor. | 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: Bottom inset in pixels. | FlowElement
|  | paddingLeft : * TextLayoutFormat: Left inset in pixels. | FlowElement
|  | paddingRight : * TextLayoutFormat: Right inset in pixels. | FlowElement
|  | paddingTop : * TextLayoutFormat: Top inset in pixels. | 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
|  | renderingMode : * TextLayoutFormat: The rendering mode used for this text. | FlowElement
|  | styleName : * TextLayoutFormat: Assigns an identifying class to the element, making it possible to set a style for the element by referencing the styleName. | FlowElement
|  | styles : Object [read-only] Returns the styles on this FlowElement. | FlowElement
|  | tabStops : * TextLayoutFormat: Specifies the tab stops associated with the paragraph. | FlowElement
|  | target : String The Target value associated with the LinkElement. | LinkElement
|  | 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
|  | typeName : String Each FlowElement has a typeName. | 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
|  | wordSpacing : * TextLayoutFormat: Specifies the optimum, minimum, and maximum spacing (as a multiplier of the width of a normal space) between words to use during justification. | FlowElement

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | LinkElement() Constructor - creates a new LinkElement instance. | LinkElement
|  | addChild(child:FlowElement):FlowElement Appends a child FlowElement object. | FlowGroupElement
|  | addChildAt(index:uint, child:FlowElement):FlowElement Adds a child FlowElement object at the specified index position. | FlowGroupElement
|  | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. | LinkElement
|  | clearStyle(styleProp:String):void Clears the style specified by the styleProp parameter from this FlowElement object. | FlowElement
|  | deepCopy(relativeStart:int = 0, relativeEnd:int = -1):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
|  | dispatchEvent(evt:Event):Boolean Dispatches an event into the event flow. | LinkElement
|  | equalUserStyles(otherElement:FlowElement):Boolean Compare the userStyles of this with otherElement's userStyles. | FlowElement
|  | findChildIndexAtPosition(relativePosition:int):int Given a relative text position, find the index of the first child FlowElement that contains the relative position. | FlowGroupElement
|  | findLeaf(relativePosition:int):FlowLeafElement Given a relative text position, find the leaf element that contains the position. | FlowGroupElement
|  | getAbsoluteStart():int Returns the start location of the element in the text flow as an absolute index. | FlowElement
|  | getCharAtPosition(relativePosition:int):String Returns the character at the specified position, relative to this FlowElement object. | FlowElement
|  | getCharCodeAtPosition(relativePosition:int):int Returns the character code at the specified position, relative to this FlowElement. | FlowElement
|  | getChildAt(index:int):FlowElement Returns the FlowElement child at the specified index. | FlowGroupElement
|  | getChildIndex(child:FlowElement):int Searches in children for the specified FlowElement object and returns its index position. | FlowGroupElement
|  | getElementRelativeStart(ancestorElement:FlowElement):int Returns the start of this element relative to an ancestor element. | FlowElement
|  | getFirstLeaf():FlowLeafElement Returns the first FlowLeafElement descendant of this group. | FlowGroupElement
|  | getLastLeaf():FlowLeafElement Returns the last FlowLeafElement descendent of this group. | FlowGroupElement
|  | getNextSibling():FlowElement Returns the next FlowElement sibling in the text flow hierarchy. | FlowElement
|  | getParagraph():ParagraphElement Returns the ParagraphElement object associated with this element. | FlowElement
|  | getPreviousSibling():FlowElement Returns the previous FlowElement sibling in the text flow hierarchy. | FlowElement
|  | getStyle(styleProp:String):* Returns the value of the style specified by the styleProp parameter, which specifies the style name and can include any user style name. | FlowElement
|  | getText(relativeStart:int = 0, relativeEnd:int = -1, paragraphSeparator:String = " "):String [override] | FlowGroupElement
|  | getTextFlow():flashx.textLayout.elements:TextFlow Climbs the text flow hierarchy to return the root TextFlow object for the element. | FlowElement
|  | hasEventListener(type:String):Boolean Checks whether the EventDispatcher object has any listeners registered for a specific type of event. | LinkElement
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | initialized(document:Object, id:String):void Called for MXML objects after the implementing object has been created and all component properties specified on the MXML tag have been initialized. | FlowElement
|  | 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
|  | removeChild(child:FlowElement):FlowElement Removes the specified child FlowElement object from the group. | FlowGroupElement
|  | removeChildAt(index:uint):FlowElement Removes the child FlowElement object at the specified index position. | FlowGroupElement
|  | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void Removes a listener from the EventDispatcher object. | LinkElement
|  | replaceChildren(beginChildIndex:int, endChildIndex:int, ... rest):void Replaces child elements in the group with the specified new elements. | FlowGroupElement
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | setStyle(styleProp:String, newValue:*):void Sets the style specified by the styleProp parameter to the value specified by the newValue parameter. | FlowElement
|  | shallowCopy(relativeStart:int = 0, relativeEnd:int = -1):FlowElement Makes a copy of this FlowElement object, copying the content between two specified character positions. | FlowElement
|  | splitAtIndex(childIndex:int):FlowGroupElement Splits this object at the position specified by the childIndex parameter. | FlowGroupElement
|  | splitAtPosition(relativePosition:int):FlowElement Splits this FlowElement object at the position specified by the relativePosition parameter, which is a relative position in the text for this element. | FlowElement
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object
|  | willTrigger(type:String):Boolean Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. | LinkElement

Events
Click for more information on events

| Event | Summary | Defined By
--- | --- | --- | ---
|  | click | Dispatched when the link is clicked. | LinkElement
|  | mouseDown | Dispatched when the mouse is pressed down over a link. | LinkElement
|  | mouseMove | Dispatched when the mouse passes over the link. | LinkElement
|  | mouseUp | Dispatched when the mouse is released over a link. | LinkElement
|  | rollOut | Dispatched when the mouse goes out of the link. | LinkElement
|  | rollOver | Dispatched when the mouse first enters the link. | LinkElement

Property Detail

### href

property

`href:String`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

The Uniform Resource Identifier (URI) associated with the LinkElement object. The URI can be any URI supported by the `flash.net.navigateToURL()` method. This property maps to the `request` parameter for that method. The URI may also be of the form `event:eventType`. When clicked the TextFlow will generate an event of type `eventType`.

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

Related API Elements

flash.net.navigateToURL()

### linkState

property

`linkState:String` [read-only]

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

The current state of the link.

Implementation
`public function get linkState():String`

Related API Elements

LinkState

### target

property

`target:String`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

The Target value associated with the LinkElement. Possible values are "_self", "_blank", "_parent", and "_top". This value maps to the `window` parameter of the `flash.net.navigateToURL()` method.

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

Related API Elements

flash.net.navigateToURL()
Constructor Detail

### LinkElement

()
Constructor

`public function LinkElement()`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Constructor - creates a new LinkElement instance.

Method Detail

### addEventListener

()
method

`public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. You can register event listeners on all nodes in the display list for a specific type of event, phase, and priority.

After you successfully register an event listener, you cannot change its priority through additional calls to `addEventListener()`. To change a listener's priority, you must first call `removeEventListener()`. Then you can register the listener again with the new priority level.

After the listener is registered, subsequent calls to `addEventListener()` with a different value for either `type` or `useCapture` result in the creation of a separate listener registration. For example, if you first register a listener with `useCapture` set to `true`, it listens only during the capture phase. If you call `addEventListener()` again using the same listener object, but with `useCapture` set to `false`, you have two separate listeners: one that listens during the capture phase, and another that listens during the target and bubbling phases.

You cannot register an event listener for only the target phase or the bubbling phase. Those phases are coupled during registration because bubbling applies only to the ancestors of the target node.

When you no longer need an event listener, remove it by calling `EventDispatcher.removeEventListener()`; otherwise, memory problems might result. Objects with registered event listeners are not automatically removed from memory because the garbage collector does not remove objects that still have references.

Copying an EventDispatcher instance does not copy the event listeners attached to it. (If your newly created node needs an event listener, you must attach the listener after creating the node.) However, if you move an EventDispatcher instance, the event listeners attached to it move along with it.

If the event listener is being registered on a node while an event is also being processed on this node, the event listener is not triggered during the current phase but may be triggered during a later phase in the event flow, such as the bubbling phase.

If an event listener is removed from a node while an event is being processed on the node, it is still triggered by the current actions. After it is removed, the event listener is never invoked again (unless it is registered again for future processing).

Parameters

| `type:String` — The type of event.
| `listener:Function` — The listener function that processes the event. This function must accept an event object as its only parameter and must return nothing, as this example shows: `function(evt:Event):void` The function can have any name.
| `useCapture:Boolean` (default = `false`)`` — Determines whether the listener works in the capture phase or the target and bubbling phases. If `useCapture` is set to `true`, the listener processes the event only during the capture phase and not in the target or bubbling phase. If `useCapture` is `false`, the listener processes the event only during the target or bubbling phase. To listen for the event in all three phases, call `addEventListener()` twice, once with `useCapture` set to `true`, then again with `useCapture` set to `false`.
| `priority:int` (default = `0`)`` — The priority level of the event listener. Priorities are designated by a 32-bit integer. The higher the number, the higher the priority. All listeners with priority n are processed before listeners of priority n-1. If two or more listeners share the same priority, they are processed in the order in which they were added. The default priority is 0.
| `useWeakReference:Boolean` (default = `false`)`` — Determines whether the reference to the listener is strong or weak. A strong reference (the default) prevents your listener from being garbage-collected. A weak reference does not. Class-level member functions are not subject to garbage collection, so you can set `useWeakReference` to `true` for class-level member functions without subjecting them to garbage collection. If you set `useWeakReference` to `true` for a listener that is a nested inner function, the function will be garbge-collected and no longer persistent. If you create references to the inner function (save it in another variable) then it is not garbage-collected and stays persistent.

### dispatchEvent

()
method

`public function dispatchEvent(evt:Event):Boolean`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Dispatches an event into the event flow. The event target is the EventDispatcher object upon which `dispatchEvent()` is called.

Parameters

| `evt:Event` — The event object dispatched into the event flow.

Returns

| `Boolean` — A value of `true` unless `preventDefault()` is called on the event, in which case it returns `false`.

### hasEventListener

()
method

`public function hasEventListener(type:String):Boolean`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Checks whether the EventDispatcher object has any listeners registered for a specific type of event. This allows you to determine where an EventDispatcher object has altered handling of an event type in the event flow hierarchy. To determine whether a specific event type will actually trigger an event listener, use `IEventDispatcher.willTrigger()`.

The difference between `hasEventListener()` and `willTrigger()` is that `hasEventListener()` examines only the object to which it belongs, whereas `willTrigger()` examines the entire event flow for the event specified by the `type` parameter.

Parameters

| `type:String` — The type of event.

Returns

| `Boolean` — A value of `true` if a listener of the specified type is registered; `false` otherwise.

### removeEventListener

()
method

`public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Removes a listener from the EventDispatcher object. If there is no matching listener registered with the EventDispatcher object, a call to this method has no effect.

Parameters

| `type:String` — The type of event.
| `listener:Function` — The listener object to remove.
| `useCapture:Boolean` (default = `false`)`` — Specifies whether the listener was registered for the capture phase or the target and bubbling phases. If the listener was registered for both the capture phase and the target and bubbling phases, two calls to `removeEventListener()` are required to remove both: one call with `useCapture` set to `true`, and another call with `useCapture` set to `false`.

### willTrigger

()
method

`public function willTrigger(type:String):Boolean`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. This method returns `true` if an event listener is triggered during any phase of the event flow when an event of the specified type is dispatched to this EventDispatcher object or any of its descendants.

The difference between `hasEventListener()` and `willTrigger()` is that `hasEventListener()` examines only the object to which it belongs, whereas `willTrigger()` examines the entire event flow for the event specified by the `type` parameter.

Parameters

| `type:String` — The type of event.

Returns

| `Boolean` — A value of `true` if a listener of the specified type will be triggered; `false` otherwise.

Event Detail

### click

Event

Event Object Type: `flashx.textLayout.events.FlowElementMouseEvent`
property FlowElementMouseEvent.type = `flashx.textLayout.events.FlowElementMouseEvent.CLICK`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Dispatched when the link is clicked. Clients may override how the link handles the event by handling it themselves, and calling preventDefault().

Defines the value of the `type` property of a `click` event object.

### mouseDown

Event

Event Object Type: `flashx.textLayout.events.FlowElementMouseEvent`
property FlowElementMouseEvent.type = `flashx.textLayout.events.FlowElementMouseEvent.MOUSE_DOWN`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Dispatched when the mouse is pressed down over a link.

Defines the value of the `type` property of a `mouseDown` event object.

### mouseMove

Event

Event Object Type: `flashx.textLayout.events.FlowElementMouseEvent`
property FlowElementMouseEvent.type = `flashx.textLayout.events.FlowElementMouseEvent.MOUSE_MOVE`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Dispatched when the mouse passes over the link.

Defines the value of the `type` property of a `mouseMove` event object.

### mouseUp

Event

Event Object Type: `flashx.textLayout.events.FlowElementMouseEvent`
property FlowElementMouseEvent.type = `flashx.textLayout.events.FlowElementMouseEvent.MOUSE_UP`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Dispatched when the mouse is released over a link.

Defines the value of the `type` property of a `mouseUp` event object.

### rollOut

Event

Event Object Type: `flashx.textLayout.events.FlowElementMouseEvent`
property FlowElementMouseEvent.type = `flashx.textLayout.events.FlowElementMouseEvent.ROLL_OUT`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Dispatched when the mouse goes out of the link.

Defines the value of the `type` property of a `rollOut` event object.

### rollOver

Event

Event Object Type: `flashx.textLayout.events.FlowElementMouseEvent`
property FlowElementMouseEvent.type = `flashx.textLayout.events.FlowElementMouseEvent.ROLL_OVER`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Dispatched when the mouse first enters the link.

Defines the value of the `type` property of a `rollOver` event object.
Examples How to use this example
LinkElementExample.as
This example adds a LinkElement to a paragraph and overrides the default format for the hover state, making the link text red.
Copy

    package flashx.textLayout.elements.examples
    {
        import flash.display.Sprite;
        import flashx.textLayout.container.ContainerController;
        import flashx.textLayout.elements.LinkElement;
        import flashx.textLayout.elements.ParagraphElement;
        import flashx.textLayout.elements.SpanElement;
        import flashx.textLayout.elements.TextFlow;
        import flashx.textLayout.formats.TextLayoutFormat;

        public class LinkElementExample extends Sprite
        {
            public function LinkElementExample()
            {
                var textFlow:TextFlow = new TextFlow();
                var textLayoutFormat:TextLayoutFormat = new TextLayoutFormat();

                textLayoutFormat.fontFamily = "Arial, Helvetica, _sans";
                textLayoutFormat.fontSize = 18;
                textFlow.hostFormat = textLayoutFormat;

                var p:ParagraphElement = new ParagraphElement();
                var span1:SpanElement = new SpanElement();
                var link:LinkElement = new LinkElement();
                var span2:SpanElement = new SpanElement();
                var inf:Object = {color:0xFF0000};
                p.linkHoverFormat = inf;
                span1.text = "Text that includes a link to ";
                link.href = "http://www.adobe.com";
                var linkSpan:SpanElement = new SpanElement();
                linkSpan.text = "Adobe's website";
                link.addChild(linkSpan);
                span2.text = ". Notice the custom formatting when the cursor hovers " +
                        "over the link.";
                p.addChild(span1);
                p.addChild(link);
                p.addChild(span2);
                textFlow.addChild(p);
                textFlow.flowComposer.addController(new ContainerController(this,stage.stageWidth, stage.stageHeight));
                textFlow.flowComposer.updateAllControllers();
            }
        }
    }

LinkElementEventExample.as
This example uses the `event:` URI scheme to generate an event to execute ActionScript code on click.
Copy

    package flashx.textLayout.elements.examples
    {
        import flash.display.Sprite;

        import flashx.textLayout.container.ContainerController;
        import flashx.textLayout.elements.LinkElement;
        import flashx.textLayout.elements.ParagraphElement;
        import flashx.textLayout.elements.SpanElement;
        import flashx.textLayout.elements.TextFlow;
        import flashx.textLayout.events.FlowElementMouseEvent;
        import flashx.textLayout.formats.TextLayoutFormat;

        public class LinkElementEventExample extends Sprite
        {
            public function LinkElementEventExample()
            {
                var textFlow:TextFlow = new TextFlow();

                textFlow.fontFamily = "Arial, Helvetica, _sans";
                textFlow.fontSize = 18;
                textFlow.paddingLeft = textFlow.paddingRight = textFlow.paddingTop = 20;

                var p:ParagraphElement = new ParagraphElement();
                var span1:SpanElement = new SpanElement();
                var link:LinkElement = new LinkElement();
                var span2:SpanElement = new SpanElement();
                span1.text = "Text that includes a link to ";
                link.href = "event:changeTextFlowColor";
                var linkSpan:SpanElement = new SpanElement();
                linkSpan.text = "custom event code"
                link.addChild(linkSpan);
                span2.text = ". Clicking the link changes the default color of the TextFlow";
                p.addChild(span1);
                p.addChild(link);
                p.addChild(span2);
                textFlow.addChild(p);
                textFlow.flowComposer.addController(new ContainerController(this,stage.stageWidth, stage.stageHeight));
                textFlow.flowComposer.updateAllControllers();
                textFlow.addEventListener("changeTextFlowColor",changeTextFlowColor)
            }

            private function changeTextFlowColor(e:FlowElementMouseEvent):void
            {
                var textFlow:TextFlow = e.flowElement.getTextFlow();
                textFlow.color = textFlow.color == 0x00ff00 ? 0 : 0x00ff00;
                textFlow.flowComposer.updateAllControllers();
            }
        }
    }

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00