/ Published in: ActionScript 3
To style the text in a TextArea component, create a TextFormat object and pass it to the TextArea's setStyle method.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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);