Adobe® Flex® 4 Language Reference
Show Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
flashx.textLayout.elements 
LinkState 
Packageflashx.textLayout.elements
Classpublic final class LinkState
InheritanceLinkState Inheritance 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

See also



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Public Methods
 MethodDefined By
 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
  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.

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.

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);
            }
        }
    }
}