flashx.textLayout.elements

# LinkState - AS3

Package | flashx.textLayout.elements
Class | public final class LinkState
Inheritance | LinkState Object

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

The LinkState class defines a set of constants for the `linkState` property of the LinkElement class.

View the examples

Related API Elements

LinkElement.linkState

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

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | 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
|  | 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

Public Constants

| Constant | Defined By
--- | --- | ---
|  | ACTIVE : String = "active" [static] Value for the active state, which occurs when you hold the mouse down over a link. | LinkState
|  | HOVER : String = "hover" [static] Value for the hover state, which occurs when you drag the mouse over a link. | LinkState
|  | LINK : String = "link" [static] Value for the normal, default link state. | LinkState

Constant Detail

### ACTIVE

Constant

`public static const ACTIVE:String = "active"`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Value for the active state, which occurs when you hold the mouse down over a link.

### HOVER

Constant

`public static const HOVER:String = "hover"`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Value for the hover state, which occurs when you drag the mouse over a link.

### LINK

Constant

`public static const LINK:String = "link"`

Language Version: | ActionScript 3.0

Runtime Versions: | Flash Player 10, AIR 1.5

Value for the normal, default link state.

Examples How to use this example
LinkStateExample.as
This example adds event listeners to a LinkElement to listen for the following mouse events: CLICK, MOUSE_DOWN, MOUSE_OUT, ROLL_OVER, ROLL_OUT. When one of these events occurs, the example checks to see if the link is in the hover state. If so, it displays the event type and `linkState` value.
Copy

    package flashx.textLayout.elements.examples
    {
        import flash.display.Sprite;
        import flash.events.MouseEvent;
        import flashx.textLayout.container.ContainerController;
        import flashx.textLayout.elements.LinkElement;
        import flashx.textLayout.elements.LinkState;
        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 LinkStateExample extends Sprite
        {
            public function LinkStateExample()
            {
                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 span:SpanElement = new SpanElement();
                var link:LinkElement = new LinkElement();
                link.addEventListener(MouseEvent.CLICK, checkState);
                link.addEventListener(MouseEvent.MOUSE_DOWN, checkState);
                link.addEventListener(MouseEvent.MOUSE_UP, checkState);
                link.addEventListener(MouseEvent.ROLL_OVER, checkState);
                link.addEventListener(MouseEvent.ROLL_OUT, checkState);

                span.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);

                p.addChild(span);
                p.addChild(link);
                textFlow.addChild(p);
                textFlow.flowComposer.addController(new ContainerController(this,stage.stageWidth, stage.stageHeight));
                textFlow.flowComposer.updateAllControllers();
            }

            public function checkState(event:FlowElementMouseEvent):void {
                var link:LinkElement = LinkElement(event.flowElement);
                if(link.linkState == LinkState.HOVER) {
                    trace("Event type is: " + event.type);
                    trace("Link state is: " + link.linkState);
                }
            }
        }
    }

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