| Pacote | flashx.textLayout.elements |
| Classe | public final class ParagraphElement |
| Herança | ParagraphElement ParagraphFormattedElement FlowGroupElement FlowElement Object |
| Versão da linguagem: | ActionScript 3.0 |
| Versões de runtime: | Flash Player 10, AIR 1.5 |
Propriedade MXML padrãomxmlChildren
Mais exemplos
Elementos da API relacionados
| Método | Definido por | ||
|---|---|---|---|
Construtor – representa um parágrafo em um fluxo de texto. | ParagraphElement | ||
![]() |
Anexa um objeto FlowElement filho. | FlowGroupElement | |
![]() |
Acrescenta um objeto FlowElement filho na posição de índice especificada. | FlowGroupElement | |
![]() | Apaga o estilo especificado por styleProp a partir deste objeto FlowElement. | FlowElement | |
![]() |
Faz uma cópia profunda deste objeto FlowElement, inclusive os filhos, copiando o conteúdo entre as duas posições de caracteres especificadas e gerando a cópia como um objeto FlowElement. | FlowElement | |
![]() | Compare o userStyles deste com o userStyles de otherElement. | FlowElement | |
![]() |
Dada uma posição relativa de texto, localiza o índice do primeiro FlowElement filho que contenha a posição relativa. | FlowGroupElement | |
![]() |
Dada uma posição relativa de texto, localizar o elemento de folha que contém a posição. | FlowGroupElement | |
Lê à frente da posição fornecida (para encontrar o local do átomo seguinte no texto) e gera o índice. | ParagraphElement | ||
Gera o índice do limite de palavra seguinte no texto. | ParagraphElement | ||
Lê para trás a partir da posição fornecida (para encontrar o local do átomo anterior no texto) e gera o índice. | ParagraphElement | ||
Gera o índice do limite de palavra anterior no texto. | ParagraphElement | ||
![]() |
Gera o local inicial do elemento no fluxo de texto como um índice absoluto. | FlowElement | |
![]() |
Gera o caractere na posição especificada, em relação a este objeto FlowElement. | FlowElement | |
![]() | Gera o código do caractere na posição especificada, em relação a este FlowElement. | FlowElement | |
![]() |
Gera o FlowElement filho no índice especificado. | FlowGroupElement | |
![]() |
Pesquisa nos filhos o objeto FlowElement especificado e gera sua posição no índice. | FlowGroupElement | |
![]() |
Gera o início deste elemento em relação a um elemento precedente. | FlowElement | |
![]() |
Gera o primeiro descendente FlowLeafElement deste grupo. | FlowGroupElement | |
![]() |
Gera o último descendente FlowLeafElement deste grupo. | FlowGroupElement | |
Gera o parágrafo seguinte a este, ou null, se não houver mais parágrafos. | ParagraphElement | ||
![]() | Gera o próximo irmão FlowElement na hierarquia do fluxo de texto. | FlowElement | |
![]() |
Gera o objeto ParagraphElement associado a este elemento. | FlowElement | |
Gera o parágrafo anterior a este, ou null se este parágrafo for o primeiro do TextFlow. | ParagraphElement | ||
![]() | Gera o irmão FlowElement anterior na hierarquia do fluxo de texto. | FlowElement | |
![]() | Gera o valor do estilo especificado pelo parâmetro styleProp, que especifica o nome do estilo e pode conter qualquer nome de estilo do usuário. | FlowElement | |
![]() | [substituir] | FlowGroupElement | |
![]() |
Sobe na hierarquia do fluxo de texto para gerar o objeto TextFlow de raiz do elemento. | FlowElement | |
![]() |
Indica se um objeto tem uma propriedade especificada definida. | Object | |
![]() | Uma chamada dos objetos MXML depois do objeto de implementação foi criada, e todas as propriedades componentes especificadas na tag de MXML foram inicializadas. | FlowElement | |
![]() |
Indica se uma ocorrência da classe Object está na cadeia de protótipos do objeto especificado como o parâmetro. | Object | |
![]() |
Indica se a propriedade especificada existe e é enumerável. | Object | |
![]() |
Retira do grupo o objeto FlowElement filho especificado. | FlowGroupElement | |
![]() |
Retira o objeto FlowElement filho da posição especificada do índice. | FlowGroupElement | |
![]() |
Substitui elementos filhos no grupo pelos novos elementos especificados. | FlowGroupElement | |
![]() |
Define a disponibilidade de uma propriedade dinâmica para operações de repetição. | Object | |
![]() | Define o estilo especificado pelo parâmetro styleProp para o valor especificado pelo parâmetro newValue. | FlowElement | |
![]() |
Produz uma cópia deste objeto FlowElement, copiando o conteúdo entre duas posições especificadas de caracteres. | FlowElement | |
![]() |
Divide este objeto na posição especificada pelo parâmetro childIndex. | FlowGroupElement | |
![]() |
Divide este objeto FlowElement na posição especificada pelo parâmetro relativePosition, que é uma posição relativa deste elemento no texto. | FlowElement | |
![]() |
Retorna a representação da string deste objeto, formatado segundo as convenções específicas para a localidade. | Object | |
![]() |
Retorna a representação de string do objeto especificado. | Object | |
![]() |
Retorna o valor primitivo do objeto especificado. | Object | |
ParagraphElement | () | Construtor |
public function ParagraphElement()| Versão da linguagem: | ActionScript 3.0 |
| Versões de runtime: | Flash Player 10, AIR 1.5 |
Construtor – representa um parágrafo em um fluxo de texto.
findNextAtomBoundary | () | método |
public function findNextAtomBoundary(relativePosition:int):int| Versão da linguagem: | ActionScript 3.0 |
| Versões de runtime: | Flash Player 10, AIR 1.5 |
Lê à frente da posição fornecida (para encontrar o local do átomo seguinte no texto) e gera o índice. O termo núcleo se refere a elementos gráficos e caracteres (inclusive grupos de caracteres combinados), as entidades indivisíveis que constituem uma linha de texto.
Parâmetros
relativePosition:int — posição inicial no texto, a partir de 0
|
int — índice no texto do seguinte átomo
|
Elementos da API relacionados
Exemplo ( Como usar este exemplo )
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| Versão da linguagem: | ActionScript 3.0 |
| Versões de runtime: | Flash Player 10, AIR 1.5 |
Gera o índice do limite de palavra seguinte no texto.
Lê à frente da posição fornecida para encontrar a próxima posição no texto que começa ou termina uma palavra.
Parâmetros
relativePosition:int — posição inicial no texto, a partir de 0
|
int — índice no texto do próximo limite de palavras
|
Exemplo ( Como usar este exemplo )
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| Versão da linguagem: | ActionScript 3.0 |
| Versões de runtime: | Flash Player 10, AIR 1.5 |
Lê para trás a partir da posição fornecida (para encontrar o local do átomo anterior no texto) e gera o índice. O termo núcleo se refere a elementos gráficos e caracteres (inclusive grupos de caracteres combinados), as entidades indivisíveis que constituem uma linha de texto.
Parâmetros
relativePosition:int — posição inicial no texto, a partir de 0
|
int — índice no texto do agrupamento anterior
|
Elementos da API relacionados
Exemplo ( Como usar este exemplo )
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| Versão da linguagem: | ActionScript 3.0 |
| Versões de runtime: | Flash Player 10, AIR 1.5 |
Gera o índice do limite de palavra anterior no texto.
Lê atrás da posição fornecida para encontrar a posição anterior no texto que começa ou termina uma palavra.
Parâmetros
relativePosition:int — posição inicial no texto, a partir de 0
|
int — índice no texto do limite de palavras anterior
|
Exemplo ( Como usar este exemplo )
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| Versão da linguagem: | ActionScript 3.0 |
| Versões de runtime: | Flash Player 10, AIR 1.5 |
Gera o parágrafo seguinte a este, ou null, se não houver mais parágrafos.
RetornaParagraphElement — o parágrafo seguinte, ou null, se não houver mais parágrafos.
|
Elementos da API relacionados
Exemplo ( Como usar este exemplo )
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| Versão da linguagem: | ActionScript 3.0 |
| Versões de runtime: | Flash Player 10, AIR 1.5 |
Gera o parágrafo anterior a este, ou null se este parágrafo for o primeiro do TextFlow.
RetornaParagraphElement |
Elementos da API relacionados
Exemplo ( Como usar este exemplo )
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();
}
}
}
Wed Jun 13 2018, 11:10 AM Z
Ocultar propriedades públicas herdadas
Mostrar propriedades públicas herdadas