| Pacchetto | flash.text.engine |
| Classe | public final class TextLineMirrorRegion |
| Ereditarietà | TextLineMirrorRegion Object |
| Versione linguaggio: | ActionScript 3.0 |
| Versioni runtime: | Flash Player 10, AIR 1.5, Flash Lite 4 |
Al termine di un normale invio di eventi per una riga di testo, se la riga è valida e la propagazione evento non è stata interrotta, gli eventi vengono nuovamente inviati nelle aree speculari della riga.
Il mirroring degli eventi mouse è un caso speciale. Poiché le aree speculari non sono realmente oggetti di visualizzazione, gli eventi mouseOver e mouseOut vengono simulati al loro posto. Gli eventi rollOver e rollOut non vengono simulati. Tutti gli eventi mouseOver, mouseOut, rollOver e rollOut che si verificano naturalmente (se assegnati alla riga di testo o a un elemento secondario della riga di testo) vengono ignorati e non vengono rispecchiati.
Non potete creare un oggetto TextLineMirrorRegion direttamente dal codice ActionScript. Se chiamate new TextLineMirrorRegion(), viene generata un'eccezione. Un oggetto TextLineMirrorRegion viene creato e associato a una riga di testo, se tale riga è stata creata da un oggetto ContentElement con impostato un evento riflesso.
La classe TextLineMirrorRegion è finale; non può avere sottoclassi.
Elementi API correlati
| Proprietà | Definito da | ||
|---|---|---|---|
| bounds : Rectangle [sola lettura]
I limiti dell'area speculare, relativamente alla riga di testo. | TextLineMirrorRegion | ||
![]() | constructor : Object
Un riferimento all'oggetto classe o alla funzione di costruzione per una determinata istanza di oggetto. | Object | |
| element : ContentElement [sola lettura]
L'oggetto ContentElement da cui è derivata l'area speculare. | TextLineMirrorRegion | ||
| mirror : EventDispatcher [sola lettura]
L'oggetto EventDispatcher in cui vengono rispecchiati gli eventi che interessano l'area speculare. | TextLineMirrorRegion | ||
| nextRegion : flash.text.engine:TextLineMirrorRegion [sola lettura]
La successiva TextLineMirrorRegion nel set derivata dall'elemento di testo, oppure null se l'area corrente è l'ultima area speculare nel set. | TextLineMirrorRegion | ||
| previousRegion : flash.text.engine:TextLineMirrorRegion [sola lettura]
La precedente TextLineMirrorRegion nel set derivata dall'elemento di testo, oppure null se l'area corrente è la prima area speculare nel set. | TextLineMirrorRegion | ||
| textLine : flash.text.engine:TextLine [sola lettura]
L'oggetto TextLine contenente questa area speculare. | TextLineMirrorRegion | ||
bounds | proprietà |
element | proprietà |
element:ContentElement [sola lettura] | Versione linguaggio: | ActionScript 3.0 |
| Versioni runtime: | Flash Player 10, AIR 1.5, Flash Lite 4 |
L'oggetto ContentElement da cui è derivata l'area speculare.
Implementazione
public function get element():ContentElementGenera
IllegalOperationError — L'oggetto TextLine a cui appartiene questo elemento non è valido.
|
mirror | proprietà |
mirror:EventDispatcher [sola lettura] | Versione linguaggio: | ActionScript 3.0 |
| Versioni runtime: | Flash Player 10, AIR 1.5, Flash Lite 4 |
L'oggetto EventDispatcher in cui vengono rispecchiati gli eventi che interessano l'area speculare. Sono inclusi gli eventi del mouse che si verificano in modo specifico nell'area speculare e tutti gli altri eventi destinati alla riga di testo.
Implementazione
public function get mirror():EventDispatchernextRegion | proprietà |
nextRegion:flash.text.engine:TextLineMirrorRegion [sola lettura] | Versione linguaggio: | ActionScript 3.0 |
| Versioni runtime: | Flash Player 10, AIR 1.5, Flash Lite 4 |
La successiva TextLineMirrorRegion nel set derivata dall'elemento di testo, oppure null se l'area corrente è l'ultima area speculare nel set. Può essere sulla stessa riga o su un'altra riga di testo.
Implementazione
public function get nextRegion():flash.text.engine:TextLineMirrorRegionpreviousRegion | proprietà |
previousRegion:flash.text.engine:TextLineMirrorRegion [sola lettura] | Versione linguaggio: | ActionScript 3.0 |
| Versioni runtime: | Flash Player 10, AIR 1.5, Flash Lite 4 |
La precedente TextLineMirrorRegion nel set derivata dall'elemento di testo, oppure null se l'area corrente è la prima area speculare nel set. Può essere sulla stessa riga o su un'altra riga di testo.
Implementazione
public function get previousRegion():flash.text.engine:TextLineMirrorRegiontextLine | proprietà |
textLine:flash.text.engine:TextLine [sola lettura] | Versione linguaggio: | ActionScript 3.0 |
| Versioni runtime: | Flash Player 10, AIR 1.5, Flash Lite 4 |
L'oggetto TextLine contenente questa area speculare.
Implementazione
public function get textLine():flash.text.engine:TextLine
package {
import flash.display.Sprite;
import flash.text.engine.TextBlock;
import flash.text.engine.TextLine;
import flash.text.engine.TextElement;
import flash.text.engine.ElementFormat;
import flash.text.engine.FontDescription;
import flash.text.engine.ContentElement;
import flash.text.engine.GroupElement;
import flash.text.engine.TextLineMirrorRegion;
import flash.events.MouseEvent;
import flash.events.EventDispatcher;
import flash.ui.Mouse;
public class TextLineMirrorRegionExample extends Sprite {
var myEvent:EventDispatcher = new EventDispatcher();
var fontDescription:FontDescription = new FontDescription();
var textBlock:TextBlock = new TextBlock();
public function TextLineMirrorRegionExample():void {
fontDescription.fontWeight = "bold";
var blackFormat:ElementFormat = new ElementFormat();
blackFormat.fontSize = 18;
blackFormat.color = 0x000000;
blackFormat.fontDescription = fontDescription;
var textElement1 = new TextElement("Click on different parts of me to find the ", blackFormat);
var textElement2 = new TextElement("mirror regions",blackFormat);
var textElement3 = new TextElement(". If I am a mirror region, I'll ",blackFormat);
var textElement4 = new TextElement("turn red",blackFormat);
var textElement5 = new TextElement(".",blackFormat);
myEvent.addEventListener("click", clickHandler);
myEvent.addEventListener("mouseOut", mouseOutHandler);
myEvent.addEventListener("mouseOver", mouseOverHandler);
var groupVector:Vector.<ContentElement> = new Vector.<ContentElement>;
groupVector.push(textElement1, textElement2, textElement3, textElement4, textElement5);
var groupElement:GroupElement = new GroupElement(groupVector);
textElement2.eventMirror=myEvent;
textElement4.eventMirror=myEvent;
textBlock.content = groupElement;
createLines(textBlock);
}
private function clickHandler(event:MouseEvent):void
{
var redFormat:ElementFormat = new ElementFormat();
redFormat.color = 0xCC0000;
redFormat.fontSize = 18;
redFormat.fontDescription = fontDescription;
var line:TextLine = event.target as TextLine;
var region:TextLineMirrorRegion = line.getMirrorRegion(myEvent);
region.element.elementFormat = redFormat;
createLines(textBlock);
}
private function mouseOverHandler(event:MouseEvent):void
{
Mouse.cursor = "button";
}
private function mouseOutHandler(event:MouseEvent):void
{
Mouse.cursor = "arrow";
}
private function createLines(textBlock:TextBlock):void
{
var purgeLine:TextLine = textBlock.firstLine;
while (purgeLine)
{
removeChild (purgeLine);
purgeLine = purgeLine.nextLine;
}
var lineWidth:Number = 150;
var xPos:Number = 15.0;
var yPos:Number = 20.0;
var textLine:TextLine = textBlock.createTextLine (null, lineWidth);
while (textLine)
{
textLine.x = xPos;
textLine.y = yPos;
yPos += textLine.height + 2;
addChild (textLine);
textLine = textBlock.createTextLine (textLine, lineWidth);
}
}
}
}
Tue Jun 12 2018, 02:44 PM Z
Nascondi proprietà pubbliche ereditate
Mostra proprietà pubbliche ereditate