| Пакет | flashx.textLayout.elements |
| Класс | public final class ParagraphElement |
| Наследование | ParagraphElement ParagraphFormattedElement FlowGroupElement FlowElement Object |
| Язык версии: | ActionScript 3.0 |
| Версии среды выполнения: | Flash Player 10, AIR 1.5 |
Свойство MXML по умолчаниюmxmlChildren
Связанные элементы API
| Метод | Определено | ||
|---|---|---|---|
Конструктор представляет абзац в текстовом потоке. | ParagraphElement | ||
![]() |
Добавляет нижестоящий объект FlowElement. | FlowGroupElement | |
![]() |
Добавляет нижестоящий объект FlowElement в заданной позиции индекса. | FlowGroupElement | |
![]() | Отменяет указанный параметром styleProp стиль в этом объекте FlowElement. | FlowElement | |
![]() |
Выполняет полное копирование объекта FlowElement, включая любые дочерние элементы (при этом копируется содержимое между двумя позициями символов), и возвращает эту копию как объект FlowElement. | FlowElement | |
![]() | Сравните userStyles этого с userStyles других элементов. | FlowElement | |
![]() |
В случае относительного расположения текста, найдите индекс первого нижестоящего FlowElement, содержащего относительную позицию. | FlowGroupElement | |
![]() |
В случае относительного расположения текста, найдите элемент листа, содержащий позицию. | FlowGroupElement | |
Выполняет сканирование текста ниже заданного положения для поиска местоположения следующего атома и возвращает его индекс. | ParagraphElement | ||
Возвращает индекс границы следующего слова в тексте. | ParagraphElement | ||
Выполняет сканирование текста выше заданного положения для поиска местоположения предыдущего атома и возвращает его индекс. | ParagraphElement | ||
Возвращает индекс границы предыдущего слова в тексте. | ParagraphElement | ||
![]() |
Возвращает начальное местоположение элемента в текстовом потоке в виде абсолютного индекса. | FlowElement | |
![]() |
Возвращает символ в указанной позиции, относительно этого объекта FlowElement. | FlowElement | |
![]() | Возвращает код символа в указанной позиции, относительно этого FlowElement. | FlowElement | |
![]() |
Возвращает нижестоящий элемент FlowElement с заданной позицией индекса. | FlowGroupElement | |
![]() |
Выполняет поиск указанного объекта FlowElement по дочерним элементам и возвращает его позицию индекса. | FlowGroupElement | |
![]() |
Возвращает начало этого элемента относительно предшествующего элемента. | FlowElement | |
![]() |
Возвращает первого потомка FlowLeafElement в этой группе. | FlowGroupElement | |
![]() |
Возвращает последнего потомка FlowLeafElement в этой группе. | FlowGroupElement | |
Возвращает абзац, следующий за данным, или значение null, если данный абзац является последним. | ParagraphElement | ||
![]() | Возвращает следующий элемент одного с FlowElement уровня в иерархии текстового потока. | FlowElement | |
![]() |
Возвращает объект ParagraphElement, связанный с этим элементом. | FlowElement | |
Возвращает абзац, предшествующий данному, или значение null, если данный абзац является первым в TextFlow. | ParagraphElement | ||
![]() | Возвращает предыдущий элемент одного с FlowElement уровня в иерархии текстового потока. | FlowElement | |
![]() | Возвращает значение стиля, заданного параметром styleProp, указывающим имя стиля, и имеющего возможность включать в себя любое имя стиля пользователя. | FlowElement | |
![]() | [переопределить] | FlowGroupElement | |
![]() |
Поднимается вверх по иерархии текстового потока для возвращения корневого объекта TextFlow для элемента. | FlowElement | |
![]() |
Показывает, определено ли заданное свойство для объекта. | Object | |
![]() | Вызывается для объектов MXML после создания объекта реализации и инициализации всех свойств компонентов, указанных в теге MXML. | FlowElement | |
![]() |
Показывает, есть ли экземпляр класса Object в цепи прототипов объекта, заданного в качестве параметра. | Object | |
![]() |
Показывает наличие заданного свойства и его перечисляемость. | Object | |
![]() |
Удаляет указанный нижестоящий объект FlowElement из данной группы. | FlowGroupElement | |
![]() |
Удаляет нижестоящий объект FlowElement в заданной позиции. | FlowGroupElement | |
![]() |
Заменяет нижестоящие элементы в группе указанными новыми элементами. | FlowGroupElement | |
![]() |
Задает доступность динамического свойства для операций цикла. | Object | |
![]() | Устанавливает стиль, указанный параметром styleProp, для значения, указанного параметром newValue. | FlowElement | |
![]() |
Создает копию этого объекта FlowElement, при этом копируется содержимое между двумя указанными позициями символов. | FlowElement | |
![]() |
Разделяет этот объект в позиции, указанной параметром childIndex. | FlowGroupElement | |
![]() |
Разделяет этот объект FlowElement в указанной параметром relativePosition позиции, которая является относительной текстовой позицией в этом элементе. | FlowElement | |
![]() |
Возвращает строковое представление этого объекта, отформатированного в соответствии со стандартами, принятыми для данной локали. | Object | |
![]() |
Возвращает строковое представление заданного объекта. | Object | |
![]() |
Возвращает элементарное значение заданного объекта. | Object | |
ParagraphElement | () | Конструктор |
public function ParagraphElement()| Язык версии: | ActionScript 3.0 |
| Версии среды выполнения: | Flash Player 10, AIR 1.5 |
Конструктор представляет абзац в текстовом потоке.
findNextAtomBoundary | () | метод |
public function findNextAtomBoundary(relativePosition:int):int| Язык версии: | ActionScript 3.0 |
| Версии среды выполнения: | Flash Player 10, AIR 1.5 |
Выполняет сканирование текста ниже заданного положения для поиска местоположения следующего атома и возвращает его индекс. Термин «атом» относится к графическим элементам и символам (включая группы объединенных символов), неделимым сущностям в строке.
Параметры
relativePosition:int — позиция в тексте, с которой начинается поиск, отсчитывается от 0
|
int — индекс следующего атома в тексте
|
Связанные элементы API
Пример ( Использование этого примера )
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 | () | метод |
public function findNextWordBoundary(relativePosition:int):int| Язык версии: | ActionScript 3.0 |
| Версии среды выполнения: | Flash Player 10, AIR 1.5 |
Возвращает индекс границы следующего слова в тексте.
Выполняет сканирование текста ниже заданного положения для поиска следующего местоположения в тексте, в котором начинается или заканчивается слово.
Параметры
relativePosition:int — позиция в тексте, с которой начинается поиск, отсчитывается от 0
|
int — индекс границы следующего слова в тексте
|
Пример ( Использование этого примера )
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 | () | метод |
public function findPreviousAtomBoundary(relativePosition:int):int| Язык версии: | ActionScript 3.0 |
| Версии среды выполнения: | Flash Player 10, AIR 1.5 |
Выполняет сканирование текста выше заданного положения для поиска местоположения предыдущего атома и возвращает его индекс. Термин «атом» относится к графическим элементам и символам (включая группы объединенных символов), неделимым сущностям в строке.
Параметры
relativePosition:int — позиция в тексте, с которой начинается поиск, отсчитывается от 0
|
int — индекс предыдущего кластера в тексте
|
Связанные элементы API
Пример ( Использование этого примера )
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 | () | метод |
public function findPreviousWordBoundary(relativePosition:int):int| Язык версии: | ActionScript 3.0 |
| Версии среды выполнения: | Flash Player 10, AIR 1.5 |
Возвращает индекс границы предыдущего слова в тексте.
Выполняет сканирование текста выше заданного положения для поиска предыдущего местоположения в тексте, в котором начинается или заканчивается слово.
Параметры
relativePosition:int — позиция в тексте, с которой начинается поиск, отсчитывается от 0
|
int — индекс границы предыдущего слова в тексте
|
Пример ( Использование этого примера )
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 | () | метод |
public function getNextParagraph():ParagraphElement| Язык версии: | ActionScript 3.0 |
| Версии среды выполнения: | Flash Player 10, AIR 1.5 |
Возвращает абзац, следующий за данным, или значение null, если данный абзац является последним.
ВозвращаетParagraphElement — следующий абзац или значение null, если данный абзац является последним.
|
Связанные элементы API
Пример ( Использование этого примера )
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 | () | метод |
public function getPreviousParagraph():ParagraphElement| Язык версии: | ActionScript 3.0 |
| Версии среды выполнения: | Flash Player 10, AIR 1.5 |
Возвращает абзац, предшествующий данному, или значение null, если данный абзац является первым в TextFlow.
ВозвращаетParagraphElement |
Связанные элементы API
Пример ( Использование этого примера )
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, 11:34 AM Z
Скрыть унаследованные общедоступные свойства
Показать унаследованные общедоступные свойства