| Paket | flashx.textLayout.elements |
| Klasse | public final class DivElement |
| Vererbung | DivElement ContainerFormattedElement ParagraphFormattedElement FlowGroupElement FlowElement Object |
| Sprachversion: | ActionScript 3.0 |
| Laufzeitversionen: | Flash Player 10, AIR 1.5 |
Standard-MXML-EigenschaftmxmlChildren
Verwandte API-Elemente
Öffentliche Eigenschaften
Öffentliche Methoden
Beispiele Verwendung dieses Beispiels
DivElementExample.as
In diesem Beispiel wird ein DivElement erstellt, durch das die Formatierung für die zwei zugehörigen Absätze angegeben wird. Der zweite Bereich im ersten Absatz gibt die zusätzliche Formatierung an, die nur dafür gilt.
package flashx.textLayout.elements.examples {
import flash.display.Sprite;
import flash.text.engine.FontPosture;
import flashx.textLayout.compose.StandardFlowComposer;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.DivElement;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.TextFlow;
public class DivElementExample extends Sprite{
public function DivElementExample(){
// create a container and a TextFlow object
var firstContainer:Sprite = new Sprite();
this.stage.addChild(firstContainer);
var textFlow:TextFlow = new TextFlow();
// create a DivElement that sets some formatting attributes
var div:DivElement = new DivElement();
div.fontSize = 14;
div.color = 0xFF3300;
div.fontStyle = FontPosture.ITALIC;
div.textIndent = 15;
// create two paragraphs that inherit formatting from the DivElement
var paragraph1:ParagraphElement = new ParagraphElement();
var p1Span1:SpanElement = new SpanElement();
p1Span1.text = "It was a dark and stormy night. ";
var p1Span2:SpanElement = new SpanElement();
p1Span2.text = "The quick red fox jumped over the lazy brown dog.";
// specify lineThrough for this span only
p1Span2.lineThrough = true;
paragraph1.addChild(p1Span1);
paragraph1.addChild(p1Span2);
var paragraph2:ParagraphElement = new ParagraphElement();
var p2Span1:SpanElement = new SpanElement();
p2Span1.text = "Peter Piper picked a peck of pickle peppers.";
paragraph2.addChild(p2Span1);
// add the two paragraphs to the DivElement
div.addChild(paragraph1);
div.addChild(paragraph2);
// add the DivElement to the TextFlow, add a composer, and update the controller
// to display the text flow
textFlow.addChild(div);
textFlow.flowComposer = new StandardFlowComposer();
var firstController:ContainerController = new ContainerController(firstContainer, 200, 200 );
textFlow.flowComposer.addController(firstController);
textFlow.flowComposer.updateAllControllers();
}
}
}
Tue Jun 12 2018, 10:04 AM Z
Vererbte öffentliche Eigenschaften ausblenden
Vererbte öffentliche Eigenschaften anzeigen