| Pacchetto | flashx.textLayout.elements |
| Classe | public final class LinkState |
| Ereditarietà | LinkState Object |
| Versione linguaggio: | ActionScript 3.0 |
| Versioni runtime: | Flash Player 10, AIR 1.5 |
linkState della classe LinkElement.
Elementi API correlati
Proprietà pubbliche
Metodi pubblici
Costanti pubbliche
| Costante | Definito da | ||
|---|---|---|---|
| ACTIVE : String = "active" [statico]
Valore dello stato attivo, che si verifica quando tenete premuto il mouse su un collegamento. | LinkState | ||
| HOVER : String = "hover" [statico]
Valore dello stato hover, che si verifica quando trascinate il mouse su un collegamento. | LinkState | ||
| LINK : String = "link" [statico]
Valore dello stato predefinito normale del collegamento. | LinkState | ||
Descrizione delle costanti
ACTIVE | Costante |
public static const ACTIVE:String = "active"| Versione linguaggio: | ActionScript 3.0 |
| Versioni runtime: | Flash Player 10, AIR 1.5 |
Valore dello stato attivo, che si verifica quando tenete premuto il mouse su un collegamento.
HOVER | Costante |
public static const HOVER:String = "hover"| Versione linguaggio: | ActionScript 3.0 |
| Versioni runtime: | Flash Player 10, AIR 1.5 |
Valore dello stato hover, che si verifica quando trascinate il mouse su un collegamento.
LINK | Costante |
public static const LINK:String = "link"| Versione linguaggio: | ActionScript 3.0 |
| Versioni runtime: | Flash Player 10, AIR 1.5 |
Valore dello stato predefinito normale del collegamento.
LinkStateExample.as
In questo esempio vengono aggiunti listener di eventi a un LinkElement per l'intercettazione dei seguenti eventi del mouse: CLICK, MOUSE_DOWN, MOUSE_OUT, ROLL_OVER, ROLL_OUT. Quando si verifica uno di questi eventi, viene controllato se il collegamento è nello stato hover (passaggio del mouse). In tal caso, visualizza il tipo di evento e il valore
linkState.
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);
}
}
}
}
Tue Jun 12 2018, 02:44 PM Z
Nascondi proprietà pubbliche ereditate
Mostra proprietà pubbliche ereditate