MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference page 1207

Components language reference
Table of Contents

Advertisement

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
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
TextField.StyleSheet
applies the style by assigning
.
my_ta
You must first add an instance of the TextArea component to the Stage and name it
then add the following code to Frame 1.
/**
Requires:
- TextArea instance on Stage (instance name: my_ta)
*/
var my_ta:mx.controls.TextArea;
my_ta.setSize(320, 240);
// Create the new StyleSheet object.
var my_styles:TextField.StyleSheet = new TextField.StyleSheet();
my_styles.setStyle("html", {fontFamily:"Arial,Helvetica,sans-serif",
fontSize:"12px", color:"#0000FF"});
my_styles.setStyle("body", {color:"#00CCFF", textDecoration:"underline"});
// Set the TextAreaInstance.styleSheet property to the newly defined
// styleSheet object named styles.
my_ta.styleSheet = my_styles;
my_ta.html = true;
// Load text to display and define onLoad handler.
var my_lv:LoadVars = new LoadVars();
my_lv.onData = function(src:String) {
if (src != undefined) {
my_ta.text = src;
} else {
my_ta.text = "Error loading HTML document.";
}
};
my_lv.load("http://www.helpexamples.com/flash/lorem.txt");
or
to remove the style sheet. If the style sheet in use
null
undefined
constructor. It then defines styles for
to the
my_styles
my_styles
html
property of the TextArea instance
styleSheet
with the
new
and
tags. Next, it
body
my_ta
TextArea.styleSheet
1203
;

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents