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 |
linkState
property
of the LinkElement class.
See also
Public Properties
Public Methods
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.
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); } } } }
Fri Mar 19 2010, 02:45 AM -07:00