| Package | flashx.textLayout.elements |
| Classe | public final class ParagraphElement |
| Héritage | ParagraphElement ParagraphFormattedElement FlowGroupElement FlowElement Object |
| Version du langage: | ActionScript 3.0 |
| Versions du moteur d’exécution: | Flash Player 10, AIR 1.5 |
Propriété MXML par défautmxmlChildren
Eléments de l’API associés
| Méthode | Défini par | ||
|---|---|---|---|
Constructeur : représente un paragraphe dans un enchaînement de texte. | ParagraphElement | ||
![]() |
Ajoute un objet FlowElement objet. | FlowGroupElement | |
![]() |
Ajoute un objet FlowElement enfant à la position d’index spécifiée. | FlowGroupElement | |
![]() | Supprime le style spécifié par le paramètre styleProp à partir de cet objet FlowElement. | FlowElement | |
![]() |
Effectue une copie en profondeur de cette objet FlowElement, y compris tout enfant, copiant le contenu entre les deux emplacements de caractère et renvoyant la copie en tant qu’objet FlowElement. | FlowElement | |
![]() | Comparez ces styles utilisateur avec les styles utilisateur d’autres éléments. | FlowElement | |
![]() |
En fonction d’une position de texte relative, recherchez l’index du premier objet FlowElement enfant qui contient la position relative. | FlowGroupElement | |
![]() |
En fonction d’une position du texte relative, recherchez l’élément de nœud terminal qui contient la position. | FlowGroupElement | |
Analyse vers l’avant à partir de la position fournie pour trouver l’emplacement dans le texte de l’atome suivant et renvoie l’index. | ParagraphElement | ||
Renvoie l’index de la prochaine limite de mot dans le texte. | ParagraphElement | ||
Analyse en arrière à partir de la position fournie pour trouver l’emplacement dans le texte de l’atome précédent et renvoie l’index. | ParagraphElement | ||
Renvoie l’index de la limite de mot précédente dans le texte. | ParagraphElement | ||
![]() |
Renvoie l’emplacement de départ de l’élément dans l’enchaînement de texte avec un index absolu. | FlowElement | |
![]() |
Renvoie le caractère à la position spécifiée, par rapport à cet objet FlowElement. | FlowElement | |
![]() | Renvoie le code de caractère à la position spécifiée, par rapport à cet objet FlowElement. | FlowElement | |
![]() |
Renvoie l’enfant de l’objet FlowElement à l’index spécifié. | FlowGroupElement | |
![]() |
Recherche dans les enfants pour l’objet FLowElement et renvoie sa position d’index. | FlowGroupElement | |
![]() |
Renvoie la valeur de début de cet élément par rapport à l’élément ancêtre. | FlowElement | |
![]() |
Renvoie le premier objet FlowLeafElement descendant de ce groupe. | FlowGroupElement | |
![]() |
Renvoie le dernier objet FlowLeafElement descendant de ce groupe. | FlowGroupElement | |
Renvoie le paragraphe suivant celui-ci, ou null s’il n’existe pas d’autre paragraphe. | ParagraphElement | ||
![]() | Renvoie le prochain objet FlowElement frère dans la hiérarchie de l’enchaînement de texte. | FlowElement | |
![]() |
Renvoie l’objet ParagraphElement associé à cet élément. | FlowElement | |
Renvoie le paragraphe qui précède celui-ci, ou la valeur null s’il s’agit du premier paragraphe de l’objet TextFlow. | ParagraphElement | ||
![]() | Renvoie l’objet FlowElement frère précédent dans la hiérarchie de l’enchaînement de texte. | FlowElement | |
![]() | Renvoie la valeur du style spécifié par le paramètre styleProp, qui spécifie le nom du style et peut être n’importe quel nom de style d’utilisateur. | FlowElement | |
![]() | [override] | FlowGroupElement | |
![]() |
Gravit la hiérarchie de l’enchaînement de texte pour renvoyer l’objet TextFlow racine pour l’élément. | FlowElement | |
![]() |
Indique si la propriété spécifiée d’un objet est définie. | Object | |
![]() | Appelé pour des objets MXML une fois que l’objet d’implémentation a été créé et que toutes les propriétés de composants spécifiées sur la balise MXML ont été initialisées. | FlowElement | |
![]() |
Indique si une occurrence de la classe Object figure dans la chaîne de prototype de l’objet spécifié en tant que paramètre. | Object | |
![]() |
Indique si la propriété spécifiée existe et est énumérable. | Object | |
![]() |
Supprime l’objet FlowElement enfant spécifié du groupe. | FlowGroupElement | |
![]() |
Supprime l’objet FlowElement enfant de la position d’index spécifiée. | FlowGroupElement | |
![]() |
Remplace les éléments enfant dans le groupe avec les nouveaux éléments spécifiés. | FlowGroupElement | |
![]() |
Définit la disponibilité d’une propriété dynamique pour les opérations en boucle. | Object | |
![]() | Définit le style spécifié par le paramètre styleProp à la valeur spécifiée par le paramètre newValue. | FlowElement | |
![]() |
Effectue une copie de cet objet FlowElement, copie le contenu entre deux positions de caractères spécifiées. | FlowElement | |
![]() |
Divise cet objet à la position spécifiée par le paramètre childIndex. | FlowGroupElement | |
![]() |
Divise cet objet FlowElement à la position spécifiée par le paramètre relativePosition, qui est une position relative dans le texte pour cet élément. | FlowElement | |
![]() |
Renvoie la représentation de chaîne de cet objet, formatée selon les paramètres régionaux en vigueur. | Object | |
![]() |
Renvoie la représentation sous forme de chaîne de l’objet spécifié. | Object | |
![]() |
Renvoie la valeur primitive de l’objet spécifié. | Object | |
ParagraphElement | () | Constructeur |
public function ParagraphElement()| Version du langage: | ActionScript 3.0 |
| Versions du moteur d’exécution: | Flash Player 10, AIR 1.5 |
Constructeur : représente un paragraphe dans un enchaînement de texte.
findNextAtomBoundary | () | méthode |
public function findNextAtomBoundary(relativePosition:int):int| Version du langage: | ActionScript 3.0 |
| Versions du moteur d’exécution: | Flash Player 10, AIR 1.5 |
Analyse vers l’avant à partir de la position fournie pour trouver l’emplacement dans le texte de l’atome suivant et renvoie l’index. Le terme atome fait à la fois référence aux éléments graphiques et aux caractères (y compris aux groupes de combinaisons de caractère), entités indivisibles qui composent une ligne de texte.
Paramètres
relativePosition:int — position de départ dans le texte, à partir de 0
|
int — index dans le texte de l’atome suivant
|
Eléments de l’API associés
Exemple ( Comment utiliser cet exemple )
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éthode |
public function findNextWordBoundary(relativePosition:int):int| Version du langage: | ActionScript 3.0 |
| Versions du moteur d’exécution: | Flash Player 10, AIR 1.5 |
Renvoie l’index de la prochaine limite de mot dans le texte.
Analyse vers l’avant à partir de la position fournie pour trouver l’emplacement suivant dans le texte qui commence ou termine un mot.
Paramètres
relativePosition:int — position de départ dans le texte, à partir de 0
|
int — index dans le texte de la prochaine limite de mot
|
Exemple ( Comment utiliser cet exemple )
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éthode |
public function findPreviousAtomBoundary(relativePosition:int):int| Version du langage: | ActionScript 3.0 |
| Versions du moteur d’exécution: | Flash Player 10, AIR 1.5 |
Analyse en arrière à partir de la position fournie pour trouver l’emplacement dans le texte de l’atome précédent et renvoie l’index. Le terme atome fait à la fois référence aux éléments graphiques et aux caractères (y compris aux groupes de combinaisons de caractère), entités indivisibles qui composent une ligne de texte.
Paramètres
relativePosition:int — position de départ dans le texte, à partir de 0
|
int — index dans le texte du cluster précédent
|
Eléments de l’API associés
Exemple ( Comment utiliser cet exemple )
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éthode |
public function findPreviousWordBoundary(relativePosition:int):int| Version du langage: | ActionScript 3.0 |
| Versions du moteur d’exécution: | Flash Player 10, AIR 1.5 |
Renvoie l’index de la limite de mot précédente dans le texte.
Analyse en arrière à partir de la position fournie pour trouver l’emplacement précédent dans le texte qui commence ou termine un mot.
Paramètres
relativePosition:int — position de départ dans le texte, à partir de 0
|
int — index dans le texte de la limite de mot précédente
|
Exemple ( Comment utiliser cet exemple )
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éthode |
public function getNextParagraph():ParagraphElement| Version du langage: | ActionScript 3.0 |
| Versions du moteur d’exécution: | Flash Player 10, AIR 1.5 |
Renvoie le paragraphe suivant celui-ci, ou null s’il n’existe pas d’autre paragraphe.
Valeur renvoyéeParagraphElement — le paragraphe suivant ou null s’il n’existe aucun autre paragraphe.
|
Eléments de l’API associés
Exemple ( Comment utiliser cet exemple )
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éthode |
public function getPreviousParagraph():ParagraphElement| Version du langage: | ActionScript 3.0 |
| Versions du moteur d’exécution: | Flash Player 10, AIR 1.5 |
Renvoie le paragraphe qui précède celui-ci, ou la valeur null s’il s’agit du premier paragraphe de l’objet TextFlow.
Valeur renvoyéeParagraphElement |
Eléments de l’API associés
Exemple ( Comment utiliser cet exemple )
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, 09:30 AM Z
Masquer les propriétés publiques héritées
Afficher les propriétés publiques héritées