| Paquete | flashx.textLayout.elements |
| Clase | public final class ParagraphElement |
| Herencia | ParagraphElement ParagraphFormattedElement FlowGroupElement FlowElement Object |
| Versión del lenguaje: | ActionScript 3.0 |
| Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Propiedad MXML predeterminadamxmlChildren
Más ejemplos
Elementos de API relacionados
| Método | Definido por | ||
|---|---|---|---|
Constructor: representa un párrafo del flujo de texto. | ParagraphElement | ||
![]() |
Añade un objeto FlowElement secundario. | FlowGroupElement | |
![]() |
Añade un objeto FlowElement secundario en la posición de índice especificada. | FlowGroupElement | |
![]() | Borra el estilo especificado por el parámetro styleProp desde este objeto FlowElement. | FlowElement | |
![]() |
Realiza una copia en profundidad de este objeto FlowElement, incluidos todos los elementos secundarios. Copia el contenido entre las dos posiciones de caracteres especificadas y devuelve la copia como un objeto FlowElement. | FlowElement | |
![]() | Compara el parámetro userStyles de este elemento con el de otro. | FlowElement | |
![]() |
Dada una posición relativa del texto, busca el índice del primer elemento secundario FlowElement que contiene la posición relativa. | FlowGroupElement | |
![]() |
Dada una posición relativa del texto, busca el elemento de hoja que contiene la posición. | FlowGroupElement | |
Busca por encima de la posición suministrada para encontrar la ubicación del siguiente átomo en el texto y devuelve el índice. | ParagraphElement | ||
Devuelve el índice del límite de la siguiente palabra en el texto. | ParagraphElement | ||
Busca por debajo de la posición suministrada para encontrar la ubicación del átomo anterior en el texto y devuelve el índice. | ParagraphElement | ||
Devuelve el índice del límite de la palabra anterior en el texto. | ParagraphElement | ||
![]() |
Devuelve la ubicación inicial del elemento en el flujo de texto como un índice absoluto. | FlowElement | |
![]() |
Devuelve el carácter en la posición especificada con relación a este objeto FlowElement. | FlowElement | |
![]() | Devuelve el código del carácter en la posición especificada con relación a este objeto FlowElement. | FlowElement | |
![]() |
Devuelve el elemento secundario FlowElement en el índice especificado. | FlowGroupElement | |
![]() |
Busca en elementos secundarios el objeto FlowElement especificado y devuelve su posición de índice. | FlowGroupElement | |
![]() |
Devuelve el inicio de este elemento con relación a un elemento antecesor. | FlowElement | |
![]() |
Devuelve el primer elemento FlowLeafElement descendente de este grupo. | FlowGroupElement | |
![]() |
Devuelve el último elemento FlowLeafElement descendente de este grupo. | FlowGroupElement | |
Devuelve el párrafo que sigue al actual, o null si no hay más párrafos. | ParagraphElement | ||
![]() | Devuelve el siguiente elemento FlowElement secundario de la jerarquía del flujo de texto. | FlowElement | |
![]() |
Devuelve el objeto ParagraphElement asociado a este elemento. | FlowElement | |
Devuelve el párrafo que antecede al actual, o null si este párrafo es el primero del objeto TextFlow. | ParagraphElement | ||
![]() | Devuelve el elemento FlowElement secundario anterior de la jerarquía del flujo de texto. | FlowElement | |
![]() | Devuelve el valor del estilo especificado en el parámetro styleProp, que especifica el nombre del estilo y puede contener cualquier nombre de estilo de usuario. | FlowElement | |
![]() | [override] | FlowGroupElement | |
![]() |
Asciende por la jerarquía del flujo de texto para devolver el objeto raíz TextFlow para el elemento. | FlowElement | |
![]() |
Indica si un objeto tiene definida una propiedad especificada. | Object | |
![]() | Llamado para objetos MXML tras crearse el objeto de implementación y todas las propiedades de componentes especificadas en la etiqueta MXML se hayan inicializado. | FlowElement | |
![]() |
Indica si hay una instancia de la clase Object en la cadena de prototipo del objeto especificado como parámetro. | Object | |
![]() |
Indica si existe la propiedad especificada y si es enumerable. | Object | |
![]() |
Elimina el objeto secundario FlowElement especificado del grupo. | FlowGroupElement | |
![]() |
Elimina el objeto secundario FlowElement situado en la posición de índice especificada. | FlowGroupElement | |
![]() |
Sustituye elementos secundarios del grupo por los elementos nuevos especificados. | FlowGroupElement | |
![]() |
Establece la disponibilidad de una propiedad dinámica para operaciones de bucle. | Object | |
![]() | Establece el estilo especificado por el parámetro styleProp en el valor especificado por el parámetro newValue. | FlowElement | |
![]() |
Hace una copia de este objeto FlowElement. Para ello, copia el contenido entre dos posiciones de caracteres especificadas. | FlowElement | |
![]() |
Divide este objeto en la posición especificada por el parámetro childIndex. | FlowGroupElement | |
![]() |
Divide este objeto FlowElement en la posición especificada por el parámetro relativePosition, que es una posición relativa en el texto para este elemento. | FlowElement | |
![]() |
Devuelve la representación de cadena de este objeto, con formato según las convenciones específicas de configuración regional. | Object | |
![]() |
Devuelve la representación de cadena del objeto especificado. | Object | |
![]() |
Devuelve el valor simple del objeto especificado. | Object | |
ParagraphElement | () | Información sobre |
public function ParagraphElement()| Versión del lenguaje: | ActionScript 3.0 |
| Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Constructor: representa un párrafo del flujo de texto.
findNextAtomBoundary | () | método |
public function findNextAtomBoundary(relativePosition:int):int| Versión del lenguaje: | ActionScript 3.0 |
| Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Busca por encima de la posición suministrada para encontrar la ubicación del siguiente átomo en el texto y devuelve el índice. El término “átomo” hace referencia a elementos gráficos y caracteres (incluidos los grupos de caracteres combinados), es decir, las entidades indivisibles que forman una línea de texto.
Parámetros
relativePosition:int — posición del texto desde la que se empieza, contando desde 0
|
int — índice en el texto del siguiente átomo
|
Elementos de API relacionados
Ejemplo ( Cómo utilizar este ejemplo )
package flashx.textLayout.elements.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
public class ParagraphElement_findNextAtomBoundary extends Sprite
{
public function ParagraphElement_findNextAtomBoundary()
{
// create the TextFlow, ParagraphElement and SpanElement objects to hold paragraph
var textFlow:TextFlow = new TextFlow();
var paragraph:ParagraphElement = new ParagraphElement();
var span:SpanElement = new SpanElement();
// assign text to the span; add span to paragraph and paragraph to TextFlow
span.text = "Hello brave, new world!";
paragraph.addChild(span);
textFlow.addChild(paragraph);
// assign a controller to the stage and update it to compose and display text
textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
textFlow.flowComposer.updateAllControllers();
// find the next atom boundaries from offsets 5 and 10
var atomBoundary:int = paragraph.findNextAtomBoundary(4);
trace(atomBoundary); // 5
atomBoundary = paragraph.findNextAtomBoundary(10);
trace(atomBoundary); // 11
}
}
}
findNextWordBoundary | () | método |
public function findNextWordBoundary(relativePosition:int):int| Versión del lenguaje: | ActionScript 3.0 |
| Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Devuelve el índice del límite de la siguiente palabra en el texto.
Busca por encima de la posición suministrada para encontrar la siguiente posición en el texto que inicia o termina una palabra.
Parámetros
relativePosition:int — posición del texto desde la que se empieza, contando desde 0
|
int — índice del límite de la siguiente palabra en el texto
|
Ejemplo ( Cómo utilizar este ejemplo )
package flashx.textLayout.elements.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
public class ParagraphElement_findNextWordBoundary extends Sprite
{
public function ParagraphElement_findNextWordBoundary()
{
// create the TextFlow, ParagraphElement and SpanElement objects to hold paragraph
var textFlow:TextFlow = new TextFlow();
var paragraph:ParagraphElement = new ParagraphElement();
var span:SpanElement = new SpanElement();
// assign text to the span; add span to paragraph and paragraph to TextFlow
span.text = "Hello brave, new world!";
paragraph.addChild(span);
textFlow.addChild(paragraph);
// assign a controller to the stage and update it to compose and display text
textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
textFlow.flowComposer.updateAllControllers();
// find the next word boundary from offsets 0 and 12
var wordBoundary:int = paragraph.findNextWordBoundary(0);
trace(wordBoundary); // 5
wordBoundary = paragraph.findNextWordBoundary(12);
trace(wordBoundary); // 13
}
}
}
findPreviousAtomBoundary | () | método |
public function findPreviousAtomBoundary(relativePosition:int):int| Versión del lenguaje: | ActionScript 3.0 |
| Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Busca por debajo de la posición suministrada para encontrar la ubicación del átomo anterior en el texto y devuelve el índice. El término “átomo” hace referencia a elementos gráficos y caracteres (incluidos los grupos de caracteres combinados), es decir, las entidades indivisibles que forman una línea de texto.
Parámetros
relativePosition:int — posición del texto desde la que se empieza, contando desde 0
|
int — índice en el texto del clúster anterior
|
Elementos de API relacionados
Ejemplo ( Cómo utilizar este ejemplo )
package flashx.textLayout.elements.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
public class ParagraphElement_findPreviousAtomBoundary extends Sprite
{
public function ParagraphElement_findPreviousAtomBoundary()
{
// create the TextFlow, ParagraphElement and SpanElement objects to hold paragraph
var textFlow:TextFlow = new TextFlow();
var paragraph:ParagraphElement = new ParagraphElement();
var span:SpanElement = new SpanElement();
// assign text to the span; add span to paragraph and paragraph to TextFlow
span.text = "Hello brave, new world!";
paragraph.addChild(span);
textFlow.addChild(paragraph);
// assign a controller to the stage and update it to compose and display text
textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
textFlow.flowComposer.updateAllControllers();
// find the previous atom boundaries from offsets 6 and 13
var atomBoundary:int = paragraph.findPreviousAtomBoundary(6);
trace(atomBoundary); // 5
atomBoundary = paragraph.findPreviousAtomBoundary(13);
trace(atomBoundary); // 12
}
}
}
findPreviousWordBoundary | () | método |
public function findPreviousWordBoundary(relativePosition:int):int| Versión del lenguaje: | ActionScript 3.0 |
| Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Devuelve el índice del límite de la palabra anterior en el texto.
Busca por debajo de la posición suministrada para encontrar la posición anterior en el texto que inicia o termina una palabra.
Parámetros
relativePosition:int — posición del texto desde la que se empieza, contando desde 0
|
int — índice del límite de la palabra anterior en el texto
|
Ejemplo ( Cómo utilizar este ejemplo )
package flashx.textLayout.elements.examples
{
import flash.display.Sprite;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
public class ParagraphElement_findPreviousWordBoundary extends Sprite
{
public function ParagraphElement_findPreviousWordBoundary()
{
// create the TextFlow, ParagraphElement and SpanElement objects to hold paragraph
var textFlow:TextFlow = new TextFlow();
var paragraph:ParagraphElement = new ParagraphElement();
var span:SpanElement = new SpanElement();
// assign text to the span; add span to paragraph and paragraph to TextFlow
span.text = "Hello brave, new world!";
paragraph.addChild(span);
textFlow.addChild(paragraph);
// assign a controller to the stage and update it to compose and display text
textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
textFlow.flowComposer.updateAllControllers();
// find the previous word boundary from offsets 0 and 12
var wordBoundary:int = paragraph.findPreviousWordBoundary(22);
trace(wordBoundary); // 17
wordBoundary = paragraph.findPreviousWordBoundary(11);
trace(wordBoundary); // 6
}
}
}
getNextParagraph | () | método |
public function getNextParagraph():ParagraphElement| Versión del lenguaje: | ActionScript 3.0 |
| Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Devuelve el párrafo que sigue al actual, o null si no hay más párrafos.
Valor devueltoParagraphElement — el siguiente párrafo o null si no hay más párrafos.
|
Elementos de API relacionados
Ejemplo ( Cómo utilizar este ejemplo )
package flashx.textLayout.elements.examples
{
import flash.display.Sprite;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
public class ParagraphElement_getNextParagraph extends Sprite
{
public function ParagraphElement_getNextParagraph()
{
// create TextFlow object
var textFlow:TextFlow = new TextFlow();
// create content for TextFlow using XML markup
var simpleText:String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<flow:TextFlow xmlns:flow=\"http://ns.adobe.com/textLayout/2008\">"+
"<flow:p>"+
"<flow:span>This is the first paragraph.</flow:span>"+
"</flow:p>"+
"<flow:p>"+
"<flow:span>This is the second paragraph.</flow:span>"+
"</flow:p>"+
"<flow:p>"+
"<flow:span>This is the third paragraph.</flow:span>"+
"</flow:p>"+
"</flow:TextFlow>";
// import the xml markup into a TextFlow object and display it on the stage
textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
textFlow.flowComposer.updateAllControllers();
// get first paragraph
var p:ParagraphElement = textFlow.getChildAt(0) as ParagraphElement;
// get next paragraph and display its content
var nextParagraph:ParagraphElement = p.getNextParagraph();
trace("nextParagraph.text is: " + nextParagraph.getText());
}
}
}
getPreviousParagraph | () | método |
public function getPreviousParagraph():ParagraphElement| Versión del lenguaje: | ActionScript 3.0 |
| Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Devuelve el párrafo que antecede al actual, o null si este párrafo es el primero del objeto TextFlow.
Valor devueltoParagraphElement |
Elementos de API relacionados
Ejemplo ( Cómo utilizar este ejemplo )
package flashx.textLayout.elements.examples
{
import flash.display.Sprite;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
public class ParagraphElement_getPreviousParagraph extends Sprite
{
public function ParagraphElement_getPreviousParagraph()
{
// create TextFlow object
var textFlow:TextFlow = new TextFlow();
// create content for TextFlow using XML markup
var simpleText:String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<flow:TextFlow xmlns:flow=\"http://ns.adobe.com/textLayout/2008\">"+
"<flow:p>"+
"<flow:span>This is the first paragraph.</flow:span>"+
"</flow:p>"+
"<flow:p>"+
"<flow:span>This is the second paragraph.</flow:span>"+
"</flow:p>"+
"<flow:p>"+
"<flow:span>This is the third paragraph.</flow:span>"+
"</flow:p>"+
"</flow:TextFlow>";
// import the xml markup into a TextFlow object and display it on the stage
textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
textFlow.flowComposer.updateAllControllers();
// get second paragraph (first = 0)
var p:ParagraphElement = textFlow.getChildAt(1) as ParagraphElement;
// get previous paragraph and display its content
var prevParagraph:ParagraphElement = p.getPreviousParagraph();
trace("prevParagraph.text is: " + prevParagraph.getText());
}
}
}
package flashx.textLayout.elements.examples
{
import flash.display.Sprite;
import flash.text.engine.FontPosture;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.formats.TextLayoutFormat;
public class ParagraphElementExample extends Sprite {
// create the TextFlow object
private var textFlow:TextFlow = new TextFlow();
// Create Strings of text for the paragraphs
private var para1String:String = "In the first paragraph of a "
private var para1String2:String = "cheap"
private var para1String3:String ="Western novel, a cowboy meets a saloon girl.";
private var para2String:String = "In the middle of the cheap novel a really bad guy, "+
"who is having a relationship with the saloon girl, sees the cowboy help "+
"her onto her horse as she smiles at him warmly."
private var para3String:String = "In the last paragraph of the cheap novel, the cowboy kills "+
"the really bad guy in a shootout in the middle of main street and "+
"then rides into the sunset with the saloon girl on the back of his horse.";
public function ParagraphElementExample()
{
// create a TextLayoutFormat object to use in formatting the paragraphs
var textLayoutFormat:TextLayoutFormat = new TextLayoutFormat();
var paragraph1:ParagraphElement = new ParagraphElement();
// create the ParagraphElement objects
var paragraph2:ParagraphElement = new ParagraphElement();
var paragraph3:ParagraphElement = new ParagraphElement();
// create the SpanElement objects to hold the content of the paragraphs
var p1Span1:SpanElement = new SpanElement();
var p1Span2:SpanElement = new SpanElement();
var p1Span3:SpanElement = new SpanElement();
var p2Span:SpanElement = new SpanElement();
var p3Span:SpanElement = new SpanElement();
// assign the strings of text for the 1st paragraph to spans
p1Span1.text = para1String;
p1Span2.text = para1String2;
p1Span2.fontStyle = FontPosture.ITALIC; // italicize 'cheap'
p1Span3.text = para1String3;
// add spans to first paragraph
paragraph1.addChild(p1Span1);
paragraph1.addChild(p1Span2);
paragraph1.addChild(p1Span3);
// assign the string of text for the 2nd paragraph to a span
// and add the span to the second paragraph
p2Span.text = para2String;
paragraph2.addChild(p2Span);
// assign the string of text for the 3rd paragraph to a span
// and add the span to the third paragraph
p3Span.text = para3String;
paragraph3.addChild(p3Span);
// add the paragraphs to the TextFlow
textFlow.addChild(paragraph1);
textFlow.addChild(paragraph2);
textFlow.addChild(paragraph3);
// set the text formatting properties
textLayoutFormat.fontSize = 14;
textLayoutFormat.textIndent = 15;
textLayoutFormat.paragraphSpaceAfter = 15;
textLayoutFormat.paddingTop = 4;
textLayoutFormat.paddingLeft = 4;
// assign the format object to the TextFlow
textFlow.hostFormat = textLayoutFormat;
// assign a controller to the stage and update it to compose and
// display the text
textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
textFlow.flowComposer.updateAllControllers();
}
}
}
package flashx.textLayout.elements.examples
{
import flash.display.Sprite;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.container.ContainerController;
public class ParagraphElementExample2 extends Sprite {
// create the TextFlow object
private var textFlow:TextFlow = new TextFlow();
// xml markup that defines the attributes and contents of a text flow
private var simpleText:String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<flow:TextFlow xmlns:flow=\"http://ns.adobe.com/textLayout/2008\" verticalScrollPolicy=\"auto\" horizontalScrollPolicy=\"auto\" editingMode=\"readWrite\" fontSize=\"14\" textIndent=\"15\" marginBottom=\"15\" paddingTop=\"4\" paddingLeft=\"4\">"+
"<flow:p>"+
"<flow:span>In the first paragraph of a </flow:span>"+
"<flow:span fontStyle=\"italic\">cheap</flow:span>"+
"<flow:span> Western novel, a cowboy meets a saloon girl.</flow:span>"+
"</flow:p>"+
"<flow:p>"+
"<flow:span>In the middle of the cheap novel a really bad guy, </flow:span>"+
"<flow:span>who is having a relationship with the saloon girl, sees the cowboy help </flow:span>"+
"<flow:span>her onto her horse as she smiles at him warmly.</flow:span>"+
"</flow:p>"+
"<flow:p>"+
"<flow:span>In the last paragraph of the cheap novel, the cowboy kills the really </flow:span>"+
"<flow:span> bad guy in a shootout in the middle of main street and then rides into the sunset with </flow:span>"+
"<flow:span>the saloon girl on the back of his horse.</flow:span>" +
"</flow:p>"+
"</flow:TextFlow>";
public function ParagraphElementExample2()
{
// import the xml markup into a TextFlow object and display it on the stage
textFlow = TextConverter.importToFlow(simpleText, TextConverter.TEXT_LAYOUT_FORMAT);
textFlow.flowComposer.addController(new ContainerController(this, 200, 400));
textFlow.flowComposer.updateAllControllers();
}
}
}
Tue Jun 12 2018, 02:12 PM Z
Ocultar propiedades públicas heredadas
Mostrar propiedades públicas heredadas