User Guide
TextArea component 739
The style sheet associated with a TextArea component may be changed at any time. If the style
sheet in use is changed, the TextArea component is redrawn with the new style sheet. The style
sheet may be set to
null or undefined to remove the style sheet. If the style sheet in use is
removed, the TextArea component is redrawn without a style sheet. The formatting done by a
style sheet is not retained if the style sheet is removed.
Example
The following code creates a new StyleSheet object named styles with the new
TextField.StyleSheet
constructor. It then defines styles for <html>, <body> and <td> tags. It
then uses
LoadVars.load to load an HTML file named myText.htm. That file contains text
within
<html>, <body> and <td> tags. When the text is displayed in the TextArea instance
MyTextArea, the text within those tags is styled according to the StyleSheet object styles.
// create the new StyleSheet object
var styles = new TextField.StyleSheet();
// define styles for <html>, <body>, and <td>...
styles.setStyle("html",
{fontFamily: 'Arial,Helvetica,sans-serif',
fontSize: '12px',
color: '#0000FF'});
styles.setStyle("body",
{color: '#00CCFF',
textDecoration: 'underline'});
styles.setStyle("td",
{fontFamily: 'Arial,Helvetica,sans-serif',
fontSize: '24px',
color: '#006600'});
// set the TextAreaInstance.styleSheet property to the newly defined
// styleSheet object named styles
myTextArea.styleSheet=styles;
myTextArea.html=true;
// Load text to display and define onLoad handler
var myVars:LoadVars = new LoadVars();
myVars.load("myText.htm");
myVars.onData = function(content) {
_root.myTextArea.text = content;
};
TextArea.text
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX 2004.