Return to Snippet

Revision: 26813
at February 2, 2011 04:25 by adrianparr


Updated Code
import flash.text.TextFormat;
import fl.controls.TextArea;
import fl.managers.StyleManager;

var myTextArea:TextArea = new TextArea();
myTextArea.setSize(200, 100);
myTextArea.text = "Hello World";

var myTextFormat:TextFormat = new TextFormat();
myTextFormat.font = "Arial";
myTextFormat.size = 18;
myTextFormat.bold = true;
myTextFormat.italic = true;
myTextFormat.underline = true;
myTextArea.setStyle("textFormat", myTextFormat);

myTextArea.x = 30;
myTextArea.y = 30;
addChild(myTextArea);

// To set ALL TextAreas to this style use ...
// StyleManager.setComponentStyle(TextArea, "textFormat", myTextFormat);

Revision: 26812
at May 11, 2010 14:38 by adrianparr


Initial Code
import flash.text.TextFormat;
import fl.controls.TextArea;

var myTextArea:TextArea = new TextArea();
myTextArea.setSize(200, 100);
myTextArea.text = "Hello World";

var myTextFormat:TextFormat = new TextFormat();
myTextFormat.font = "Arial";
myTextFormat.size = 18;
myTextFormat.bold = true;
myTextFormat.italic = true;
myTextFormat.underline = true;
myTextArea.setStyle("textFormat", myTextFormat);

myTextArea.x = 30;
myTextArea.y = 30;
addChild(myTextArea);

Initial URL

                                

Initial Description
To style the text in a TextArea component, create a TextFormat object and pass it to the TextArea's setStyle method.

Initial Title
AS3 Format the Text of a TextArea Component

Initial Tags
format, text

Initial Language
ActionScript 3